python-ini文件读取

import configparser
class GetConfig():
def __init__(self,file):
self.cf = configparser.ConfigParser()
self.cf.read(file)


def getConfigValue(self,section,name):
value = self.cf.get(section,name)
return value

print(GetConfig('test.ini').getConfigValue('config','platformName'))
posted @ 2020-07-04 22:21  静惜  阅读(156)  评论(0)    收藏  举报