Windows 7, python 2.6.6, 2.7
Create directory 'c:\1\test.'
Try check if it is dir or file, but it is neither:
>>> os.listdir('c:/1')
['test.']
>>> os.path.isdir('c:/1')
True
>>> os.path.exists('c:/1/test.')
False
>>> os.path.isdir('c:/1/test.')
False
>>> os.path.isfile('c:/1/test.')
False
Why directory with . at end not recognized as file system entry at all? But I can obtain it from os.listdir.
mkdir
or the explorer, I always end up withtest
.os.listdir
confirms this (['test']
).os.isdir
returnsTrue
for bothtest
(and fortest.
, presumably because the dot is stripped there as well) andos.isfile
returnsFalse
as expected.