summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-09-29 18:56:41 (GMT)
committerGregory P. Smith <greg@krypto.org>2012-09-29 18:56:41 (GMT)
commit8ce589cf7b874f3d0323612e0c25f12cc6d844da (patch)
tree826f559dfff62ca685ee36a9a6e94bdfa901a78b
parent02dee1acd8d905a2348e5ed4d9f97cb490e5e255 (diff)
parentad4d9c9bf019608b5729adf0d4257c4a7cbf41b0 (diff)
downloadcpython-8ce589cf7b874f3d0323612e0c25f12cc6d844da.zip
cpython-8ce589cf7b874f3d0323612e0c25f12cc6d844da.tar.gz
cpython-8ce589cf7b874f3d0323612e0c25f12cc6d844da.tar.bz2
merge heads
-rw-r--r--Doc/library/configparser.rst14
1 files changed, 7 insertions, 7 deletions
diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst
index c202cf2..958375b 100644
--- a/Doc/library/configparser.rst
+++ b/Doc/library/configparser.rst
@@ -770,9 +770,9 @@ An example of writing to a configuration file::
# values using the mapping protocol or ConfigParser's set() does not allow
# such assignments to take place.
config.add_section('Section1')
- config.set('Section1', 'int', '15')
- config.set('Section1', 'bool', 'true')
- config.set('Section1', 'float', '3.1415')
+ config.set('Section1', 'an_int', '15')
+ config.set('Section1', 'a_bool', 'true')
+ config.set('Section1', 'a_float', '3.1415')
config.set('Section1', 'baz', 'fun')
config.set('Section1', 'bar', 'Python')
config.set('Section1', 'foo', '%(bar)s is %(baz)s!')
@@ -790,13 +790,13 @@ An example of reading the configuration file again::
# getfloat() raises an exception if the value is not a float
# getint() and getboolean() also do this for their respective types
- float = config.getfloat('Section1', 'float')
- int = config.getint('Section1', 'int')
- print(float + int)
+ a_float = config.getfloat('Section1', 'a_float')
+ an_int = config.getint('Section1', 'an_int')
+ print(a_float + an_int)
# Notice that the next output does not interpolate '%(bar)s' or '%(baz)s'.
# This is because we are using a RawConfigParser().
- if config.getboolean('Section1', 'bool'):
+ if config.getboolean('Section1', 'a_bool'):
print(config.get('Section1', 'foo'))
To get interpolation, use :class:`ConfigParser`::