blob: 7f8e2f04549082efceb7d27fbdf43b53a4de4b6d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# 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']
|