[Tutor] UTF-8 filenames encountered in os.walk
Terry Carroll
carroll at tjc.com
Wed Jul 4 03:04:16 CEST 2007
On Tue, 3 Jul 2007, William O'Higgins Witteman wrote:
> Has anyone found a silver bullet for ensuring that all the filenames
> encountered by os.walk are treated as UTF-8? Thanks.
What happens if you specify the starting directory as a Unicode string,
rather than an ascii string, e.g., if you're walking the current
directory:
for thing in os.walk(u'.'):
instead of:
for thing in os.walk('.'):
More information about the Tutor
mailing list