Commit 38f4e468 authored by Inada Naoki's avatar Inada Naoki Committed by GitHub

bpo-17110: doc: add note how to get bytes from sys.argv (GH-12602)

parent 7444daad
...@@ -30,6 +30,12 @@ always available. ...@@ -30,6 +30,12 @@ always available.
To loop over the standard input, or the list of files given on the To loop over the standard input, or the list of files given on the
command line, see the :mod:`fileinput` module. command line, see the :mod:`fileinput` module.
.. note::
On Unix, command line arguments are passed by bytes from OS. Python decodes
them with filesystem encoding and "surrogateescape" error handler.
When you need original bytes, you can get it by
``[os.fsencode(arg) for arg in sys.argv]``.
.. data:: base_exec_prefix .. data:: base_exec_prefix
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment