有这么一个需求,你想从文件中读取字典,方法有很多,这里用的是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

  

相关文章:

  • 2020-12-19
  • 2021-05-24
  • 2021-10-18
  • 2021-08-21
  • 2021-12-28
  • 2021-06-13
  • 2021-06-10
猜你喜欢
  • 2022-01-23
  • 2022-12-23
  • 2021-06-27
  • 2021-05-23
  • 2021-11-18
  • 2023-03-27
相关资源
相似解决方案