[Python-Dev] r88121 - python/branches/py3k/Doc/whatsnew/3.2.rst

Georg Brandl g.brandl at gmx.net
Fri Jan 21 08:33:48 CET 2011


Am 20.01.2011 10:04, schrieb raymond.hettinger:

> +os
> +--
> +
> +Different operating systems use various encodings for filenames and environment
> +variables.  The :mod:`os` module provides two new functions,
> +:func:`~os.fsencode` and :func:`~os.fsdecode`, for encoding and decoding
> +filenames:
> +
> +>>> filename = 'словарь'
> +>>> os.fsencode(filename)
> +b'\xd1\x81\xd0\xbb\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x80\xd1\x8c'
> +>>> open(os.fsencode(filename))

Please do not include Cyrillic characters directly in the source -- it breaks
the LaTeX PDF build.  A non-ascii name from the latin-1 range should be fine.

Georg



More information about the Python-Dev mailing list