遇到问题,解决问题,记录解决方案,一气呵成
from configparser import ConfigParser
'''
;config.ini
[DEFAULT]
ServerAliveInterval = 45
Compression = yes
CompressionLevel = 9
ForwardX11 = yes
'''
cfg = ConfigParser()
# 用utf-8编码打开config.ini文件
cfg.read('config.ini', encoding="utf-8")
cfg.sections()
cfg.get('DEFAULT', 'ServerAliveInterval')
cfg.get('DEFAULT', 'Compression')
cfg.get('DEFAULT', 'CompressionLevel')
cfg.get('DEFAULT', 'ForwardX11')