Skip to content

Commit

Permalink
bpo-21018: added missing documentation about escaping characters for …
Browse files Browse the repository at this point in the history
…configparser (GH-6137) (GH-15845)

Document how $ and % can be escaped in configparser.
(cherry picked from commit 9a94093)

Co-authored-by: Arun Persaud <arun@nubati.net>
  • Loading branch information
2 people authored and JulienPalard committed Sep 10, 2019
1 parent 61f34f9 commit 122bbf7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Doc/library/configparser.rst
Expand Up @@ -313,6 +313,8 @@ from ``get()`` calls.
my_dir: %(home_dir)s/lumberjack
my_pictures: %(my_dir)s/Pictures
[Escape]
gain: 80%% # use a %% to escape the % sign (% is the only character that needs to be escaped)
In the example above, :class:`ConfigParser` with *interpolation* set to
``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of
Expand Down Expand Up @@ -346,6 +348,9 @@ from ``get()`` calls.
my_dir: ${home_dir}/lumberjack
my_pictures: ${my_dir}/Pictures
[Escape]
cost: $$80 # use a $$ to escape the $ sign ($ is the only character that needs to be escaped)
Values from other sections can be fetched as well:

.. code-block:: ini
Expand Down

0 comments on commit 122bbf7

Please sign in to comment.