Revision 3 as of 2007-11-16 17:46:32

Clear message

These are some examples on using ConfigParser, assuming the following INI file...

[SectionOne]
Status: Single
Name: Derek
Value: Yes
Age: 29
Single: True

[SectionTwo]
FavoriteColor=Green
[SectionThree]
FamilyName: Johnson

[Others]
Route: 66

>>> from ConfigParser import ConfigParser
>>> Config = ConfigParser()
>>> Config
<ConfigParser.ConfigParser instance at 0x00BA9B20>
>>> Config.read("c:\\tomorrow.ini")
['c:\\tomorrow.ini']
>>> Config.sections()
['Others', 'SectionThree', 'SectionOne', 'SectionTwo']
>>> 


CategoryDocumentation

Unable to edit the page? See the FrontPage for instructions.