Difficult-Rocket/tests/_test_config_file.py

27 lines
525 B
Python
Raw Normal View History

2021-05-24 05:58:16 +08:00
import configparser
configs = configparser.ConfigParser()
configs.read('test_config.config')
2021-07-08 20:42:22 +08:00
# print(configs.sections())
back = {}
2021-05-24 05:58:16 +08:00
for c in configs.sections():
2021-07-08 20:42:22 +08:00
back[c] = {}
2021-05-24 05:58:16 +08:00
for con in configs[c]:
2021-07-08 20:42:22 +08:00
back[c][con] = configs[c][c]
# name = configs[c][con]
# print(c, con, name)
print('ree')
b = {}
for c in configs:
print(c)
b[c] = configs[c]
# print(configs['a'])
print('ree')
2021-05-24 05:58:16 +08:00
conf = configparser.ConfigParser()
2021-07-08 20:42:22 +08:00
# conf.read('test_config.config')
# print(type(conf))
print(back)
print(b)