2022-07-20 22:02:46 +08:00
|
|
|
import configparser
|
2022-07-04 17:19:50 +08:00
|
|
|
from PikaStdLib import MemChecker
|
2022-07-04 07:16:44 +00:00
|
|
|
config = configparser.ConfigParser()
|
2022-07-04 17:42:05 +08:00
|
|
|
|
|
|
|
config_string = '[DEFAULT]\n\
|
2022-07-04 07:16:44 +00:00
|
|
|
ServerAliveInterval = 45\n\
|
|
|
|
Compression = yes\n\
|
|
|
|
CompressionLevel = 9\n\
|
|
|
|
ForwardX11 = yes\n\
|
|
|
|
\n\
|
|
|
|
[bitbucket.org]\n\
|
|
|
|
User = hg\n\
|
|
|
|
\n\
|
|
|
|
[topsecret.server.com]\n\
|
|
|
|
Port = 50022\n\
|
2022-07-12 15:12:37 +08:00
|
|
|
ForwardX11 = no\n\
|
|
|
|
content = http://sbkpda.hazz.hrss.gov.cn:9001/nontax_platforml/nontax/pay?Q=wj%2Bf'
|
2022-07-04 17:42:05 +08:00
|
|
|
|
|
|
|
config.read_string(config_string)
|
2022-07-04 17:19:50 +08:00
|
|
|
|
2022-07-04 17:42:05 +08:00
|
|
|
print('\n========== config_string ==========')
|
|
|
|
print(config_string)
|
|
|
|
|
|
|
|
print('\n===== config.sections() =====')
|
2022-07-04 17:19:50 +08:00
|
|
|
print(config.sections())
|
2022-07-04 17:42:05 +08:00
|
|
|
|
|
|
|
print('\n===== config.options("DEFAULT") =====')
|
2022-07-04 17:19:50 +08:00
|
|
|
print(config.options('DEFAULT'))
|
|
|
|
mem = MemChecker()
|
|
|
|
|
|
|
|
config.set('bitbucket.org', 'User', 'hhdd123')
|
2022-07-04 17:42:05 +08:00
|
|
|
|
|
|
|
print('\n========= config["bitbucket.org"] bitbucket.org ===========')
|
2022-07-04 17:19:50 +08:00
|
|
|
print(config['bitbucket.org'])
|
|
|
|
|
|
|
|
section = config['bitbucket.org']
|
|
|
|
section['User'] = '3833qwe'
|
2022-07-04 17:42:05 +08:00
|
|
|
|
|
|
|
print('\n========= config["bitbucket.org"] ===========')
|
2022-07-04 17:19:50 +08:00
|
|
|
print(config['bitbucket.org'])
|
|
|
|
|
2022-07-04 17:42:05 +08:00
|
|
|
print('\n========= config.items("DEFAULT") ===========')
|
2022-07-04 17:19:50 +08:00
|
|
|
print(config.items('DEFAULT'))
|
|
|
|
|
2022-07-04 17:42:05 +08:00
|
|
|
print('\n=============== all ================')
|
|
|
|
print(config)
|
|
|
|
|
2022-07-04 17:19:50 +08:00
|
|
|
print("mem used now: %0.2f kB" % mem.getNow())
|
|
|
|
print("mem used max: %0.2f kB" % mem.getMax())
|