selenium data read module

Txt the data stored in e.g.  

 

def info(path):
web_info={}
config = open(path)
for line in config:
result = [ele.strip() for ele in line.split('=')]
# print(result)
# print(dict([result]))
web_info.update(dict([result]))
return web_info
if __name__ == '__main__':#测试用
t = info(r'D:\untitled\python\7.30\web_info.txt')
# print(t)
for key in t:
print(key,t[key])

 

Guess you like

Origin www.cnblogs.com/wulinmiao/p/11426867.html