小编lem*_*ess的帖子

TypeError:'str'对象不可调用于在while循环中打印字典

我正在编写一个代码字游戏(也称为替换字符)程序我正在写的问题,我一直得到错误'str'对象不可调用.这是我的代码(只是涉及这个字典的while循环的一部分:

used_pairings = {}

while.....:
    used_pairings[guesschar] = guessletter
    print = ("At this point you can decide whether to delete a character-letter pairing.")
    used_pairings_choice = input("Type 1 to delete a pairing or ENTER to carry on: ")
    if used_pairings_choice == "1":
        print ("These are your pairings so far:")
        print (used_pairings)
    else:
        print ("Continuing program.")
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

"Codeword.py", line 79, in <module>
    print ("These are your pairings so far:")
TypeError: 'str' object not callable
Run Code Online (Sandbox Code Playgroud)

我完全不同意这意味着什么以及为什么我收到此错误消息所以任何帮助将不胜感激.提前致谢!

python

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

标签 统计

python ×1