Double Backslash Python Os.path.abspath
I get the path dire=os.path.abspath('.') and for fileName in filter(os.path.isfile, os.listdir(path=direc)) but dire has C:\\ and sends me the next error: TypeError: listdir()
Solution 1:
I'm assuming that by print
you mean repr
.
s = 'C:\\'
s
>>> 'C:\\'print(s)
>> C:\
Note that while printing there aren't neither double \\
nor '
The other point is the error TypeError: listdir() takes no keyword arguments
so why dont try:
for fileName infilter(os.path.isfile, os.listdir(direc))
instead of
for fileName infilter(os.path.isfile, os.listdir(path=direc))
Post a Comment for "Double Backslash Python Os.path.abspath"