Python 2.6.5 is said to support Unicode? How come listdir() doesn’t in IDLE, but Python 3.1.2 does show Unicode in IDLE? (this is tested on Windows 7)
The following code is the same behavior:
for dirname, dirnames, filenames in os.walk('c:\path\somewhere'):
for subdirname in dirnames:
print (os.path.join(dirname, subdirname))
for filename in filenames:
print (os.path.join(dirname, filename))
Update: the unicode is in the filenames, not in the path…
The syntax for Unicode strings changed from 2 to 3. Try specifying a Unicode string like this:
If you want the syntax of Python 3 (string literals are by default Unicode unless the
bprefix is given), useat the top of your file.