# https://docs.python.org/3/library/configparser.html # import configparser # config = configparser.ConfigParser() # config['DEFAULT'] = {'ServerAliveInterval': '45', # 'Compression': 'yes', # 'CompressionLevel': '9'} # config['forge.example'] = {} # config['forge.example']['User'] = 'hg' # config['topsecret.server.example'] = {} # topsecret = config['topsecret.server.example'] # topsecret['Port'] = '50022' # mutates the parser # topsecret['ForwardX11'] = 'no' # same here # config['DEFAULT']['ForwardX11'] = 'yes' # with open('example.ini', 'w') as configfile: # config.write(configfile) # config = configparser.ConfigParser() # config.sections() # config.read('example.ini') # config.sections() # topsecret = config['topsecret.server.example'] # topsecret['ForwardX11'] # topsecret['Port'] # for key in config['forge.example']: # print(key) # config['forge.example']['ForwardX11']