diff options
author | Martin Abente Lahaye <tch@sugarlabs.org> | 2013-01-12 21:53:08 (GMT) |
---|---|---|
committer | Martin Abente Lahaye <tch@sugarlabs.org> | 2013-01-12 21:53:08 (GMT) |
commit | 1b04cd7cc11177b200e78be9925d1c9eb77a497f (patch) | |
tree | 5757c85ede68cf52426f512d146325c433a7a6f0 | |
parent | b9272c9dd4f3311253e933ce4a7f0dd555380122 (diff) |
Basic ConfigParser example
-rw-r--r-- | 003-ConfigParser/config.ini | 3 | ||||
-rwxr-xr-x | 003-ConfigParser/example.py | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/003-ConfigParser/config.ini b/003-ConfigParser/config.ini new file mode 100644 index 0000000..8b7530e --- /dev/null +++ b/003-ConfigParser/config.ini @@ -0,0 +1,3 @@ +[person] +name = tch +lastname = sugarlabs diff --git a/003-ConfigParser/example.py b/003-ConfigParser/example.py new file mode 100755 index 0000000..c1f687a --- /dev/null +++ b/003-ConfigParser/example.py @@ -0,0 +1,13 @@ +#!/usr/bin/python + +from ConfigParser import SafeConfigParser + + +def main(): + parser = SafeConfigParser() + parser.read('config.ini') + + print parser.get('person', 'name') + +if __name__ == "__main__": + main() |