pythoneval函数错误_python中eval函数未实现错误
我在⽤Python龟做东西。下⾯显⽰的eval函数应该运⾏h()或i()。这些是⽬前唯⼀可以⼯作的函数,因此只有hi或ih或i或h可以⼯作。控制台返回notimplementederror:eval is not implemented。我不明⽩,因为我进⼊了⼀个全新的领域,并添加了eval('1')之类的基本代码,但这也不起作⽤。顺便说⼀句,我是python新⼿,所以我不擅长python,所以如果我犯了愚蠢的错误,请注意我。在import turtle
from time import sleep
ninja = turtle.Turtle()
ninja.hideturtle()
coordinate1 = ()
coordinate2 = ()
new1=''
new2=''
ninja.speed(10)
def h():
ninja.left(90)
ninja.forward(50)
ninja.back(100)
ninja.forward(50)
ninja.right(90)
ninja.forward(35)
ninja.left(90)
ninja.forward(-50)
ninja.forward(100)
coordinate1 = ()
coordinate2 = ()
new1 = coordinate1+50
ninja.penup()
<(new1,0)
def i():
ninja.forward(20)
ninja.pendown()
ninja.left(90)
ninja.st()
ninja.right(90)
ninja.stamp()
ninja.ht()
ninja.penup()
ninja.back(20)
ninja.pendown()
ninja.back(50)
coordinate1 = ()
new1 = coordinate1+50
ninja.penup()
<(new1,0)
h()
i()
name = input('What is your name. It will be drawn in the tab to the left lowercase only please.') print('The name will begin to draw in the tab to the left')
python新手代码及作用
sleep(3)
ninja.clear()
<(0,0)
name = list(name)
print(name)
length = len(name)
x=0
while (x < length-1):
print(name[x])
x = x + 1
new2=name[x]+'()'
print(new2)
eval(new2)

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。