Skip to content

Commit 5cf8155

Browse files
miss-islingtonarunpersaud
authored andcommitted
bpo-21018: added missing documentation about escaping characters for configparser (GH-6137) (GH-15846)
Document how $ and % can be escaped in configparser. (cherry picked from commit 9a94093) Co-authored-by: Arun Persaud <[email protected]>
1 parent c43f26e commit 5cf8155

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/configparser.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ from ``get()`` calls.
313313
my_dir: %(home_dir)s/lumberjack
314314
my_pictures: %(my_dir)s/Pictures
315315
316+
[Escape]
317+
gain: 80%% # use a %% to escape the % sign (% is the only character that needs to be escaped)
316318
317319
In the example above, :class:`ConfigParser` with *interpolation* set to
318320
``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of
@@ -346,6 +348,9 @@ from ``get()`` calls.
346348
my_dir: ${home_dir}/lumberjack
347349
my_pictures: ${my_dir}/Pictures
348350
351+
[Escape]
352+
cost: $$80 # use a $$ to escape the $ sign ($ is the only character that needs to be escaped)
353+
349354
Values from other sections can be fetched as well:
350355

351356
.. code-block:: ini

0 commit comments

Comments
 (0)