标签:字典 account imp code file exe pen 读取文件 .exe
有这么一个需求,你想从文件中读取字典,方法有很多,这里用的是ast模块
import ast with open("account","r",encoding="utf8") as read_file: data = ast.literal_eval(read_file.read()) print(type(data)) ##演示结果 C:\python3.5\python.exe D:/qq文件存放地/day9/FTP/测试/测试读取文件.py <class ‘dict‘> Process finished with exit code 0
标签:字典 account imp code file exe pen 读取文件 .exe
原文地址:http://www.cnblogs.com/uglyliu/p/6149752.html