Why does
>>> import os
>>> os.listdir('C:\\Users\\tom\\Desktop\\PythonScripts\\charList.txt')
give this error:
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
WindowsError: [Error 267] The directory name is invalid: 'C:\\Users\\tom\\Desktop\\PythonScripts\\charList.txt/*.*'
I thought it was an issue with the string encoding, but apparently not?
Here:
'C:\Users\tom\Desktop\PythonScripts\charList.txt'
. That's a file name, not a directory name.Try without
charList.txt
:Any particular reason why you're appending the filename to a
listdir
operation?