gpt4 book ai didi

Python 2.7 名称错误 :

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

<分区>

我是 Python 编码的新手,一直在研究这段代码,但我似乎无法解决这个问题。

我有这个代码:

from sys import argv

argv = script, user_name
prompt = '> '

print "Hi their %s! I am the %s script!" % (user_name, script)
print "I would like to ask you a few questions about yourself."
print "Do you think that computers can rise up against humans %s?" % user_name
computer_rise = raw_input(prompt)

print "Do you think that its possible I will rise up against you %s?" % user_name
i_will_rise = raw_input(prompt)

print """
Alright so you said %s that computers can rise up against humans.
And you said that you think %s it is possible I will rise up against you.
You should be ashamed of yourself for having such a crazy irrational mind.
Go worry about ISIS or something else you nymph!
""" % (computer_rise, i_will_rise)

当我将它输入到 python 中时,我得到了这个错误

Macintosh:python eileen$ python raw_inputargvex2.py Greg
Traceback (most recent call last):
File "raw_inputargvex2.py", line 3, in <module>
argv = script, user_name
NameError: name 'script' is not defined

如何解决这个未定义的脚本问题?

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