gpt4 book ai didi

python - 类型错误 : 'str' object is not callable for printing a dictionary inside a while loop

转载 作者:太空宇宙 更新时间:2023-11-04 08:10:47 25 4
gpt4 key购买 nike

<分区>

我在编写代码字游戏(也称为替换字符)程序时遇到问题,并且不断收到错误“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.")

这是我得到的错误:

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

我完全不明白这意味着什么以及为什么我会收到此错误消息,因此非常感谢您的帮助。提前致谢!

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com