1

When I am using filename="media\documents\dog_bark.wav" Python works fine and my intended functionality works.

But with filename="media\documents\afile1.wav", filename="media\documents\732-20.wav" and similar other selected filepaths it's changing the first character of the filename to \x07, I have also seen \x08 and so on

Why does this happen and is there any solution for this?

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153

1 Answers1

0

Are you using like that "media\\documents\\afile1.wav" , right? with double \

"media\documents \afile1.wav" \a is a char

"media\documents \732-20.wav" \7 is a char also

when you use \d it is not a char so it changing to \\d in a string

you can use r" RAW STRING " if you do not want to care about it.