python 书上文件相关练习(五角星多一条边)

import turtle as t
t.title('自动轨迹绘制')
t.setup(800,600,0,0)
t.pencolor('red')
t.pensize(5)

datals=[]
f=open("4.21.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[i][3],datals[i][4],datals[i][5])
    t.fd(datals[i][0])
    if datals[i][1]:
        t.right(datals[i][2])
    else:
        t.left(datals[i][2])

python 书上文件相关练习(五角星多一条边)_第1张图片

你可能感兴趣的:(Python)