python turtle与 for in循环
各位大神走过路过拉一拉小弟我。万分感谢!想请教下列代码里,for in循环每次绘画的起点都是在(800,600,0,0) or 在上一笔画的终点?
代码:
#AutoTraceDraw.py
import turtle as t
t.title("自动轨迹绘制")
t.setup(800,600,0,0)
t.pencolor("red")
t.pensize(5)
#数据读取
datals=[]
f=open("data.txt")
for line in f:
line = line.replace("\n","")
datals.append(list(map(eval,line.split(","))))
f.close()
for i in range(len(datals)):
t.pencolor(datals,datals,datals)
t.fd(datals)
if datals:
t.right(datals)
else :
t.left(datals)
for in循环的部分又在复制粘贴的时候出了bug。{:10_266:}
for i in range(len(datals)):
t.pencolor(datals,datals,datals)
t.fd(datals)
if datals:
t.right(datals)
else :
t.left(datals) 赤梦云 发表于 2020-5-9 16:40
for in循环的部分又在复制粘贴的时候出了bug。
for i in range(len(datals)):
t.pencolor( ...
发data.txt
页:
[1]