python读取文件中的字典
import ast
def file_read():
with open('D:\\pytharm\\jichuyufa\\day2\\pro_cty_con.txt', 'r', encoding='utf8') as f:
san_dic = ast.literal_eval(f.read())
return san_dic
dic = file_read()
print(dic)
import ast
def file_read():
with open('D:\\pytharm\\jichuyufa\\day2\\pro_cty_con.txt', 'r', encoding='utf8') as f:
san_dic = ast.literal_eval(f.read())
return san_dic
dic = file_read()
print(dic)