实现代码如下:
# 读取配置文件,取其值组成列表class ReadTxt: def read_txt(self,path): li_info = [] with open(path) as f: li = f.readlines() for i in li: a = i.split("=")[1] b = a.strip("\n") li_info.append(b) return li_info