小编Cha*_*nヨネ的帖子

TypeError:索引到字典时,'type'对象不可订阅

我有多个文件需要加载,所以我用a dict来缩短内容.当我运行时,我得到一个"TypeError:'type'对象不可订阅"错误.我怎样才能让它发挥作用?

TypeError: 'type' object is not subscriptable 
Run Code Online (Sandbox Code Playgroud)

python dictionary python-3.x

14
推荐指数
2
解决办法
13万
查看次数

如何将 Int 保存到文本文件

我试图将名为“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)

python python-3.x

0
推荐指数
1
解决办法
2475
查看次数

标签 统计

python ×2

python-3.x ×2

dictionary ×1