import configparser
config = configparser.ConfigParser()
config['DEFAULT'] = {
'debug': True
}
config['web_server'] = {
'host': '127.0.0.1',
'port': 80
}
config['db_server'] = {
'host': '127.0.0.1',
'port': 3306
}
with open('config.ini', 'w') as config_file:
config.write(config_file)
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme