Commit d8850685 by BellCodeEditor

auto save

parent 3ce31792
Showing with 28 additions and 21 deletions
""" # file1 =open(r'C:\\Users\\Lenovo\\Desktop\\test.txt','w',encoding="utf-8")
使用turtle模块画图 # file1.write('小兰:13本\n')
每次移动都增加画笔移动的长度,并旋转91°,重复执行300次,查看效果 # file1.close()
""" # file1 =open(r'C:\\Users\\Lenovo\\Desktop\\test.txt','w',encoding="utf-8")
import turtle # file1.write('小兰:13本\n')
# file1.write('小强:10本\n')
# file1.write('李明:15本\n')
pen = turtle.Pen() # file1.close()
screen = turtle.Screen() with open(r'C:\\Users\\Lenovo\\Desktop\\test.txt','r',encoding="utf-8") as file1:
screen.bgcolor("light pink") for date in file1:
colors=["white","blue","violet","cyan"] if '小强:10本\n'in date:
# 请创造师在下面接着创作 print('数据在文件中')
distance=1
pen.speed(1000)
for i in range(1,300):
pen.pencolor(colors[i%4]) # file1.write('小兰:13本\n')
pen.forward(i)
pen.right(91)
# 隐藏画笔,保存画布
pen.hideturtle()
turtle.done()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment