os.path.isdir do not work for Foder named '2011-07-03'
tjreedy at udel.edu
Tue Jul 19 19:51:09 CEST 2011
On 7/19/2011 2:15 AM, Thomas 'PointedEars' Lahn wrote:
> Steven D'Aprano wrote:
>> Nulpum wrote:
>>> I want to make sure that folder exists.
>>> '2011-07-03' is really exists. but 'os.path.isdir' say false
>>> Does anyone know why?
>>>>> print "logs/2011-07-03"
>>>>> print "logs\2011-07-03"
>> Don't use backslashes as path separators in Python. Backslashes are used
>> for string escapes.
> Besides that, and permission issues, ISTM that there are Unicode characters
> (at least non-ASCII characters) in the OP's path, which means they should
> # encoding: utf-8
That is the default in Py3. Not sure of OP specified what he used.
> or something else fitting, and use
Terry Jan Reedy
More information about the Python-list