selenium数据读取模块

例如 数据保存在txt中  

 

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])

 


posted @ 2019-08-28 22:12  暖o0兮  阅读(201)  评论(0编辑  收藏  举报