Skip to content

Commit 3ac4e78

Browse files
authored
[doc] configparser: avoid inline comments. (GH-31247)
People are testing those blocs with the default inline_comment_prefixes of None, leading to a: configparser.InterpolationSyntaxError: '$' must be followed by '$' or '{', found: '$ sign ($ is the only character that needs to be escaped)'
1 parent ec8906f commit 3ac4e78

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Doc/library/configparser.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,8 @@ from ``get()`` calls.
347347
my_pictures: %(my_dir)s/Pictures
348348
349349
[Escape]
350-
gain: 80%% # use a %% to escape the % sign (% is the only character that needs to be escaped)
350+
# use a %% to escape the % sign (% is the only character that needs to be escaped):
351+
gain: 80%%
351352
352353
In the example above, :class:`ConfigParser` with *interpolation* set to
353354
``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of
@@ -382,7 +383,8 @@ from ``get()`` calls.
382383
my_pictures: ${my_dir}/Pictures
383384
384385
[Escape]
385-
cost: $$80 # use a $$ to escape the $ sign ($ is the only character that needs to be escaped)
386+
# use a $$ to escape the $ sign ($ is the only character that needs to be escaped):
387+
cost: $$80
386388
387389
Values from other sections can be fetched as well:
388390

0 commit comments

Comments
 (0)