Why?

Gabriel Genellina gagsl-py at yahoo.com.ar
Mon Feb 5 20:04:26 EST 2007


En Mon, 05 Feb 2007 21:32:23 -0300, NoName <zaz600 at gmail.com> escribió:

> # -*- coding: cp1251 -*-
> from glob import glob
>
> src= "C:\\0000\\Новая папка\\*.*"
print "src=",src
print "repr(src)=",repr(src)
> print glob(src)
for fn in glob(src):
   print fn
>
>
>
>
>
> ['C:\\0000\\\xcd\xee\xe2\xe0\xff \xef\xe0\xef\xea\xe0\\ksdjfk.txt', 'C:
> \\0000\\\xcd\xee\xe2\xe0\xff \xef
> \xe0\xef\xea\xe0\\\xeb\xfb\xe2\xee\xe0\xeb\xee\xe0\xeb.txt']
>
> Why not "C:\\0000\\Новая папка\\ksdjfk.txt" and etc?

glob returns a list; when you print a list, it uses repr() on its  
elements. It *looks* strange, but has the right contents. See the above  
modifications.

-- 
Gabriel Genellina




More information about the Python-list mailing list