Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13981

Can't print out a list of files in a folder using os.listdir ("...") error Python [duplicate]

$
0
0

I'm trying to get a list of all the files in this folder then print them but I keep getting an error (using python).

import os

files = os.listdir("C:\Users\Alex\Desktop\Channel")

Error - File "C:\Users\Alex\PycharmProjects\First\venv\First.py", line 2files = os.listdir("C:\Users\Alex\Desktop\Channel")^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape.

I moved the folder around and changed its name many times but nothing seems to work.


Viewing all articles
Browse latest Browse all 13981

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>