Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
73753d35
Commit
73753d35
authored
Sep 22, 2009
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#6969: make it explicit that configparser writes/reads text files, and fix the example.
parent
8355e7c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
Doc/library/configparser.rst
Doc/library/configparser.rst
+9
-6
No files found.
Doc/library/configparser.rst
View file @
73753d35
...
...
@@ -231,9 +231,11 @@ RawConfigParser Objects
.. method:: RawConfigParser.readfp(fp, filename=None)
Read and parse configuration data from the file or file-like object in *fp*
(only the :meth:`readline` method is used). If *filename* is omitted and *fp*
has a :attr:`name` attribute, that is used for *filename*; the default is
``<???>``.
(only the :meth:`readline` method is used). The file-like object must
operate in text mode, i.e. return strings from :meth:`readline`.
If *filename* is omitted and *fp* has a :attr:`name` attribute, that is used
for *filename*; the default is ``<???>``.
.. method:: RawConfigParser.get(section, option)
...
...
@@ -279,8 +281,9 @@ RawConfigParser Objects
.. method:: RawConfigParser.write(fileobject)
Write a representation of the configuration to the specified file object. This
representation can be parsed by a future :meth:`read` call.
Write a representation of the configuration to the specified file object,
which must be opened in text mode (accepting strings). This representation
can be parsed by a future :meth:`read` call.
.. method:: RawConfigParser.remove_option(section, option)
...
...
@@ -370,7 +373,7 @@ An example of writing to a configuration file::
config.set('Section1', 'foo', '%(bar)s is %(baz)s!')
# Writing our configuration file to 'example.cfg'
with open('example.cfg', 'w
b
') as configfile:
with open('example.cfg', 'w') as configfile:
config.write(configfile)
An example of reading the configuration file again::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment