summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2019-09-10 12:51:09 (GMT)
committerJulien Palard <julien@palard.fr>2019-09-10 12:51:09 (GMT)
commit9a94093189417adddd6b59d6c80cc5544630c8aa (patch)
tree8f2bac1d0dfcc84c0a72f00ddcd1dcdd0520504b
parent734f1202a50641eb2c4bfbcd5b75247c1dc99a8f (diff)
downloadcpython-9a94093189417adddd6b59d6c80cc5544630c8aa.zip
cpython-9a94093189417adddd6b59d6c80cc5544630c8aa.tar.gz
cpython-9a94093189417adddd6b59d6c80cc5544630c8aa.tar.bz2
bpo-21018: added missing documentation about escaping characters for configparser (GH-6137)
Document how $ and % can be escaped in configparser.
-rw-r--r--Doc/library/configparser.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst
index 04b52dc..739477f 100644
--- a/Doc/library/configparser.rst
+++ b/Doc/library/configparser.rst
@@ -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
@@ -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