config.ini
[socket]
host=112.124.20.20port=7777 loading config.inicf = ConfigParser.ConfigParser()
path = os.path.split(os.path.realpath(__file__))[0] + '/config.ini'(绝对路径)cf.read(path)print(cf.get('socket', 'host'))本文共 269 字,大约阅读时间需要 1 分钟。
config.ini
[socket]
host=112.124.20.20port=7777 loading config.inicf = ConfigParser.ConfigParser()
path = os.path.split(os.path.realpath(__file__))[0] + '/config.ini'(绝对路径)cf.read(path)print(cf.get('socket', 'host'))转载于:https://my.oschina.net/phper1234/blog/222095