Last active
August 29, 2015 14:17
-
-
Save datamafia/5bb9712797d8d8c45a49 to your computer and use it in GitHub Desktop.
MVP Proto for *.cfg reading (Python 2.7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[section] | |
key=value | |
otherKey=otherValue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""doc string""" | |
from __future__ import print_function | |
import os | |
from ConfigParser import SafeConfigParser | |
file_loc = os.path.dirname(os.path.realpath(__file__))+'/config.cfg' | |
parser = SafeConfigParser() | |
parser.read(file_loc) | |
print (parser.get('section','key')) | |
print (parser.get('section','otherKey')) | |
''' | |
value | |
otherValue | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment