Python 类型错误:Can';t转换为';内置函数或方法';对象隐式地访问str

Python 类型错误:Can';t转换为';内置函数或方法';对象隐式地访问str,python,string,python-3.x,typeerror,Python,String,Python 3.x,Typeerror,我正在用Python3制作一个简单的mad libs程序,用户输入名词和代词,程序应该打印出用户的输入 这是我的密码: print ("Welcome to Mad Libs. Please enter a word to fit in the empty space.") proper_noun = input("One day _________ (Proper Noun)").lower() ing_verb = input("Was __________ (Verb + ing) to

我正在用Python3制作一个简单的mad libs程序,用户输入名词和代词,程序应该打印出用户的输入

这是我的密码:

print ("Welcome to Mad Libs. Please enter a word to fit in the empty space.")

proper_noun = input("One day _________ (Proper Noun)").lower()
ing_verb = input("Was __________ (Verb + ing) to the").lower()
noun1= input("to the _________ (Noun)").lower()
pronoun1 = input("On the way, _____________ (Pronoun)").lower()
noun2 = input("Saw a ________ (Noun).").lower
pronoun2 = input("This was a surprise so ________ (Pronoun)").lower()
verb2 = input("_________ (verb) quickly.").lower()
#Asks user to complete the mad libs

print ("One day " + proper_noun)
print ("Was " + ing_verb + " to the")
print (noun1 + ". " + "On the way,")
print (pronoun1 + " saw a " + noun2 + ".")
print ("This was a surprise")
print ("So " + pronoun2 + " " + verb2 + " quickly.")
获取此错误代码:
TypeError:无法将“内置函数”或“方法”对象隐式转换为str

在这一行:

print (pronoun1 + " saw a " + noun2 + ".")

对python来说相当陌生,所以我不完全确定这个错误意味着什么以及如何修复它,有人能给我解释一下这个错误代码吗

问题在于noune2变量

noun2 = input("Saw a ________ (Noun).").lower
您正在分配函数。将其降低,而不是调用它的结果。您应该将函数调用为.lower()-


给未来的读者

当您尝试使用
+
运算符连接包含字符串的变量时,遇到诸如-
类型错误:无法将“内置函数”或“方法”对象隐式转换为str的问题

问题基本上是其中一个变量实际上是一个函数/方法,而不是实际的字符串

当您尝试调用字符串上的某个函数时,通常会发生这种情况(与OP的情况相同),但却忽略了它的
()
语法(与OP的情况相同)——

如果没有
()
语法,只需将函数/方法分配给变量,而不是调用函数的实际结果。要调试这些问题,您可以检查分配给变量的行(用于抛出错误的行),并检查是否错过了调用任何函数

noun2 = input("Saw a ________ (Noun).").lower()
name = name.lower   #It should have been `name.lower()`