'str' object is not callable, with print

青春壹個敷衍的年華 提交于 2019-12-02 23:00:37

问题


#python3

applicant = input("Enter the applicant's name: ")
interviewer = input("Enter the interviewer's name: ")
time = input("Enter the appointment time: ")
print(interviewer, applicant,  time)

always show error:
TypeError: 'str' object is not callable

How to deal with this?I am a beginner, this problem has made me crazy!


回答1:


You have definitely used a variable named print and assigned a string to it before this code.

Did you try to print like this before this code?

print = 'something,something'

That's wrong. It basically makes print a variable and when you try to call the print function it instead calls this variable which has a string stored in it.

Solution:- Well if you are writing code in an interpreter(which is most probably what you did), just open a new one and write the correct code only. if you have a .py file, then just edit out the print = 'something' part. That's my guess. All the best.



来源:https://stackoverflow.com/questions/45620669/str-object-is-not-callable-with-print

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!