红旗

五星红旗
import
turtle def goto(x,y): turtle.up() turtle.goto(x,y) turtle.down() def draw(x): turtle.begin_fill() for i in range(5): turtle.forward(x) turtle.right(144) turtle.end_fill() turtle.setup(600,400,0,0) turtle.color('yellow') turtle.bgcolor('red') turtle.fillcolor('yellow') goto(-250,75) # turtle.up() # turtle.goto(-250,75) # turtle.down() draw(100) # turtle.begin_fill() # for i in range(5): # turtle.forward(100) # turtle.right(144) # turtle.end_fill() goto(-100,175) # turtle.up() # turtle.goto(-100,150) # turtle.down() turtle.right(6) draw(50) # turtle.begin_fill() # for i in range(5): # turtle.forward(50) # turtle.right(144) # turtle.end_fill() goto(-100,-25) draw(50) goto(-70,108) draw(50) goto(-70,42) turtle.left(2) draw(50) turtle.done()




字符串练习

html = 'http://news.gzcc.cn/html/2018/xiaoyuanxinwen_0314/9024.html'
print(html[-14:-5], '\n ----------------------')

html_end = '.html'
html1 = 'https://docs.python.org/dev/library/'
a = ['string', 'sys', 'turtle', 'os']
for g in a:
    html = html1 + str(g) + html_end
    print(html)
print('\n ----------------------')

new_html = 'http://news.gzcc.cn/html/2018/xiaoyuanxinwen/'
new=new_html+'index'+html_end
print(new)
for i in range(2, 229):
    new = new_html + str(i) + html_end
    print(new)




 
原文地址:https://www.cnblogs.com/BOBOWZH/p/8603321.html