|
configparser
See Also Python Docs IntroductionPython 3 includes a module named configparser, that assists programmers interface with a configuration file. I recommend the usage of this module, but it is not required. Recommended Usage_name # Name of game fullconfig # The entire config file, kept for saving config # The config data for this game only _name = 'Game Name'
# Reading
fullconfig = configparser.ConfigParser()
fullconfig.read('config.ini')
config = fullconfig[_name]
# Saving
with open('config.ini') as configfile:
fullconfig.write(configfile)Configuration data for your module is stored in config as a dictionary. |