mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
bpo-21018: added missing documentation about escaping characters for configparser (GH-6137)
Document how $ and % can be escaped in configparser.
This commit is contained in:
parent
734f1202a5
commit
9a94093189
1 changed files with 5 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue