[Python-checkins] cpython (merge 3.3 -> 3.3): merge heads
gregory.p.smith
python-checkins at python.org
Sat Sep 29 20:58:51 CEST 2012
http://hg.python.org/cpython/rev/26f06a9d17b1
changeset: 79270:26f06a9d17b1
branch: 3.3
parent: 79267:ba8d85552e34
parent: 79262:769247e6edbf
user: Gregory P. Smith <greg at krypto.org>
date: Sat Sep 29 11:56:41 2012 -0700
summary:
merge heads
files:
Doc/library/configparser.rst | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst
--- a/Doc/library/configparser.rst
+++ b/Doc/library/configparser.rst
@@ -770,9 +770,9 @@
# 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 @@
# 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`::
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list