import turtle turtle.screensize(bg='red') turtle.color('yellow') def mygoto(x,y): turtle.up() turtle.goto(x,y) turtle.down() mygoto(-250, 125) turtle.begin_fill() for i in range(5): turtle.forward(125) turtle.right(144) turtle.end_fill() mygoto(-105, 165) turtle.left(40) turtle.begin_fill() for i in range(5): turtle.forward(35) turtle.right(144) turtle.end_fill() mygoto(-30, 135) turtle.right(10) turtle.begin_fill() for i in range(5): turtle.right(144) turtle.forward(35) turtle.end_fill() mygoto(-40, 75) turtle.left(40) turtle.begin_fill() for i in range(5): turtle.right(144) turtle.forward(35) turtle.end_fill() mygoto(-75, 20) turtle.right(20) turtle.begin_fill() for i in range(5): turtle.right(144) turtle.forward(35) turtle.end_fill() turtle.done()
运行结果截图:
字符串练习:
http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html
取得校园新闻的编号
str = 'http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html' print(str[-14:-5])
https://docs.python.org/3/library/turtle.html
产生python文档的网址
addr1 = 'https://docs.python.org/3.6/library/' addr2 = '.html' addr = addr1 + 'turtle' + addr2 print(addr)
http://news.gzcc.cn/html/xiaoyuanxinwen/4.html
产生校园新闻的一系列新闻页网址
for i in range(2,229): print('http://news.gzcc.cn/html/xiaoyuanxinwen/{}.html'.format(i))