os.path.isdir do not work for Foder named '2011-07-03'

Changjun changjun.cho at gmail.com
Tue Jul 19 10:25:43 CEST 2011


On 7월19일, 오후3시15분, Thomas 'PointedEars' Lahn <PointedE... at web.de>
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?
>
> > Yes.
>
> >>>> print "logs/2011-07-03"
> > logs/2011-07-03
> >>>> print "logs\2011-07-03"
> > logs 1-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
> declare
>
> # encoding: utf-8
>
> or something else fitting, and use
>
> os.path.isdir(u"C:/Users/조창준/Desktop/logs/2011-07-03")
>
> or something else fitting.
>
> --
> PointedEars
>
> Bitte keine Kopien per E-Mail. / Please do not Cc: me.

Thanks...
u Option is work :)



More information about the Python-list mailing list