|
Size: 167
Comment:
|
Size: 591
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| These are some examples on using ConfigParser... | These are some examples on using ConfigParser, assuming the following INI file... |
| Line 3: | Line 3: |
| {{{#!python import ConfigParser import sys ConfigFileName="c:\\tomorrow.ini" |
{{{ [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'] >>> |
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']
>>> 