python 2.7 def错误

python 2.7 def错误,python,function,Python,Function,当我把它打印出来时,它就消失了 def h(x): x = ((x[0])*len(x)) return x h(他) 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 h(他) 名称错误:未定义名称“he” 你是想把他作为字符串传递吗“他”将是合适的方式 h(he) Traceback (most recent call last): File "<pyshell#45>", line 1, in <module> h(he) N

当我把它打印出来时,它就消失了

def h(x):
     x = ((x[0])*len(x))
     return x
h(他)
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
h(他)
名称错误:未定义名称“he”

你是想把
他作为字符串传递吗<代码>“他”
将是合适的方式

h(he)

Traceback (most recent call last):
  File "<pyshell#45>", line 1, in <module>
    h(he)
NameError: name 'he' is not defined

>>hh

我不能让这个网站缩进,但我在程序中缩进正确了?“他”是声明的吗?可能是拼写错误吗?也许你的意思是h('he')?声明是什么意思?对不起,我是初学者,天哪,谢谢!!!!audionuma这是引语:(@hihidsdsd)如果这解决了你的问题,请随意接受答案。
def h(x):
     x = ((x[0])*len(x))
     return x

print(h('he'))