0

I have a simple Question, I'm using the following Code to open multiple files in Python but it doesn't work, it just gives me one error.

Error:

"SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape "

for name in glob.glob('C:\Users\lpa\namefolder1\namefolder2\namefolder3/*'):
Mikev
  • 2,012
  • 1
  • 15
  • 27
Lpng
  • 109
  • 1
  • 8
  • Use a raw string: `r'C:\Users\lpa\namefolder1\namefolder2\namefolder3/*'` – Thierry Lathuille Feb 27 '19 at 09:54
  • It says "invalid Syntax" – Lpng Feb 27 '19 at 09:56
  • Possible duplicate of ["Unicode Error "unicodeescape" codec can't decode bytes... Cannot open text files in Python 3](https://stackoverflow.com/questions/1347791/unicode-error-unicodeescape-codec-cant-decode-bytes-cannot-open-text-file) Do refer this post. – damagedCoda Feb 27 '19 at 09:57
  • @lpng Did you put the `r` in front to turn your string into a raw string? I get errors without it, but none with it... – Thierry Lathuille Feb 27 '19 at 10:09

0 Answers0