import turtle turtle.setup(600, 400, 0, 0) turtle.color('yellow') turtle.bgcolor('red') turtle.fillcolor('yellow') turtle.speed(10) def mygoto(x,y): turtle.up() turtle.goto(x,y) turtle.down() def write(x): turtle.begin_fill() for i in range(5): turtle.forward(x) turtle.right(144) turtle.end_fill() mygoto(-220,75) write(100) for n in range(4): x=1 if n in [0,3]: x=0 mygoto(-100+x*50,150-n*60) turtle.right(15-n*15) write(30) turtle.done()
取得校园新闻的编号:
str = "http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html" print (str[-9:-5])
产生python文档的网址:
str = "https://docs.python.org/3/library/turtle.html"; print(str.replace("turtle", "test"))
产生校园新闻的一系列新闻页网址:
for i in range[2,299]: print("http://news.gzcc.cn/html/xiaoyuanxinwen/{}.html".format(i))