summaryrefslogtreecommitdiffstats
path: root/Doc/library/os.rst
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-05-08 11:10:09 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-05-08 11:10:09 (GMT)
commit449c466e7d17292c46c08ef9a458fbdc5ddb7987 (patch)
tree87f02ca27a0f64708d8618012252d7678f6ac44a /Doc/library/os.rst
parent4cda46ab9167ab6c46e1cbb6caea6fbb021605ac (diff)
downloadcpython-449c466e7d17292c46c08ef9a458fbdc5ddb7987.zip
cpython-449c466e7d17292c46c08ef9a458fbdc5ddb7987.tar.gz
cpython-449c466e7d17292c46c08ef9a458fbdc5ddb7987.tar.bz2
Issue #8514: Add os.fsencode() function (Unix only): encode a string to bytes
for use in the file system, environment variables or the command line.
Diffstat (limited to 'Doc/library/os.rst')
-rw-r--r--Doc/library/os.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 577c600..1d4b1e1 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -155,6 +155,17 @@ process and user.
These functions are described in :ref:`os-file-dir`.
+.. function:: fsencode(value)
+
+ Encode *value* to bytes for use in the file system, environment variables or
+ the command line. Uses :func:`sys.getfilesystemencoding` and
+ ``'surrogateescape'`` error handler for strings and returns bytes unchanged.
+
+ Availability: Unix.
+
+ .. versionadded:: 3.2
+
+
.. function:: get_exec_path(env=None)
Returns the list of directories that will be searched for a named