我有多个文件需要加载,所以我用a dict来缩短内容.当我运行时,我得到一个"TypeError:'type'对象不可订阅"错误.我怎样才能让它发挥作用?
TypeError: 'type' object is not subscriptable
Run Code Online (Sandbox Code Playgroud) 我试图将名为“curmov”的 int 保存到一个文本文件中,以便以后可以再次访问它。我不断收到 TypeError: must be str, not int. 我需要它保持完整。任何想法
curmov = 21
def savemov():
global curmov
text_file = open("curmov.txt", "w+")
text_file.write(curmov)
text_file.close()
Run Code Online (Sandbox Code Playgroud)