如何解决为什么 PyCharm 在 input() 和 print() 函数中给出错误 - “未解析的引用”?
如图所示,只有“Magic-I”的 print()
和 input()
有问题
我会给你完整的代码:
outcome = {
"hi": "Hello","hello": "Hi","what's your name": "Magic-I !","this": "'this' what?","you are mad": "You too.....LEL !!!","your hobby": "Solving problems","fuck off": ".........","i like you": "Me too",}
help = '''
'calculate' - addition ; subtraction ; multiplication ; division.
'car game' - simple car simulator.
'guess game' - launch a simple guessing game.
'rbi' - launch RBI.
'bye' - exit AI
||type 'help' whenever you need to kNow these commands||
*It also chat*
'''
print("----------------------------------------------------------------------------------------------------------")
print("\nThis is an AI - 'MAGIC I' !")
print("It chats and complete several other tasks !")
print("\nSome key features (type these to access them): ")
print(help)
k = ""
while True:
res = input("\n> ").lower()
if res in outcome:
k = outcome.get(res)+" !"
print(k)
elif "name" in res:
print("Magic-I !")
elif "fuck" in res:
print('........')
elif "parent" in res:
print("Rakshit")
elif "master" in res:
print("Rakshit")
elif "coder" in res:
print("Rakshit")
elif "programmer" in res:
print("Rakshit")
elif "calc" in res:
import calculator
calculator.calculator()
elif 'car' in res:
import CarGame
elif 'guess' in res:
import GuessGame
elif 'rbi' in res:
import RBI
elif 'ac' in res:
print("Turn it on !!!")
elif 'help' in res:
print(help)
elif res == "bye":
print("Bye..!")
break
elif res == "":
print("You haven't typed anything..!")
else:
print("No.!")
这是代码......如果你想要别的东西,我可以给你......请帮忙!!!
文件夹:
嘿,当我尝试修复 print() 问题时,它显示了 install print() 包,类似的东西...当我单击它时,出现错误:
解决方法
也许你应该删除 ~/.bash_profile 中的 pythonpath 变量 您可以使用以下方法来做到这一点:- #export PYTHONPATH=/usr/local/lib/python2.7/site-packages/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。