# -*- coding: utf-8 -*-
#displays title
print (" H___________________________________________ ")
print ("/========/| █░█ █▀▀█ █▀▀█ █░░ █▀▀█ █▀▀▄ █▀▀▄ \ ")
print ("|||||||||||-█̶▀̶▄̶ ̶█̶░̶░̶█̶ ̶█̶░̶░̶█̶ ̶█̶░̶░̶ ̶█̶▄̶▄̶█̶ ̶█̶░̶░̶█̶ ̶█̶░̶░̶█̶ -\ ")
print ("\========\|_▀̲░̲▀̲ ̲▀̲▀̲▀̲▀̲ ̲▀̲▀̲▀̲▀̲ ̲▀̲▀̲▀̲ ̲▀̲░̲░̲▀̲ ̲▀̲░̲░̲▀̲ ̲▀̲▀̲▀̲░̲ __\ ")
print (" H ")
print (" = ")
#intro
print ("Welcom to the land of kool")
#asks your name
name = input ("Can you tell me your name!")
#says hello
print ("Well hello",name,"!")
显示错误:
NameError: name '______' is not defined
根据您使用的Python版本,您可能需要使用。。你知道吗
name = raw_input("Can you tell me your name!")
看看这个以供参考。 What's the difference between raw_input() and input() in python3.x?
TL;博士
在python2.x中使用
raw_input()
而不是input()
,因为input()
是eval(raw_input))
的“速记”。你知道吗在python2.7中,需要使用
raw_input()
而不是input()
。raw_input()
允许您以字符串的形式读入用户输入,而input()
是eval(raw_input())
的“速记”,它试图以文本Python代码的形式评估用户输入Python2.x文档中对此进行了说明:
但是,这一点后来在python3.x中发生了更改。在python3.x中,
raw_input()
变成了input()
,旧的输入(eval(raw_input())
)被删除。这在What's new in Python 3中有记载:(我的重点)
所以在python2.x中使用
raw_input()
而不是input()
,因为input()
是eval(raw_input))
的“速记”。例如,改变:name = input ("Can you tell me your name!")
至
name = raw_input ("Can you tell me your name!")
相关问题 更多 >
编程相关推荐