python笔记

config.ini

[socket]
host=112.124.20.20
port=7777


loading config.ini

cf = ConfigParser.ConfigParser()
path = os.path.split(os.path.realpath(__file__))[0] + '/config.ini'(绝对路径)
cf.read(path)
print(cf.get('socket', 'host'))

你可能感兴趣的:(python笔记)