H
Hannu Kankaanp??
This may be a bug or simply a strange result of undefined
behaviour, but this is what I get with Python 2.3.2 on
Windows XP:
Maybe os.listdir() behaviour is undefined for empty strings,
but the different behaviour between unicode and normal
strings surprised me. If calling it with an empty string is
illegal, it should throw an exception instead of doing
weird things.
This works fine, though:
behaviour, but this is what I get with Python 2.3.2 on
Windows XP:
[ filenames in the drive's root directory, e.g. c:\ ]import os
os.listdir('') [ filenames in the current directory, e.g. c:\python\ ]
os.listdir(u'')
Maybe os.listdir() behaviour is undefined for empty strings,
but the different behaviour between unicode and normal
strings surprised me. If calling it with an empty string is
illegal, it should throw an exception instead of doing
weird things.
This works fine, though:
[ filenames in the current directory, e.g. c:\python\ ]os.listdir('.') [ filenames in the current directory, e.g. c:\python\ ]
os.listdir(u'.')