Python基础综合练习

# -*- coding: UTF-8 -*-
import turtle

def mygoto(x,y):
    turtle.up()
    turtle.goto(x,y)
    turtle.down()
def drawwu(x):
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(x)
        turtle.right(144)
    turtle.end_fill()
turtle.setup(600,400,0,00)
turtle.color('yellow')
turtle.bgcolor('red')
turtle.color('yellow')
turtle.speed(10)
mygoto(-220,95)
drawwu(100)

for i in range(4):
    x=1
    if i in [0,3]:
        x=0
    mygoto(-100+x*50,150-i*40)
    turtle.left(15 - i * 15)
    drawwu(50)
turtle.done()

 产生校园新闻的一系列新闻页网址

str1 = 'http://news.gzcc.cn/html/xiaoyuanxinwen/'
str2 = '.html'

for i in range(1,10):
str3 = str1 + str(i) + str2
print(str3)

取得校园新闻的编号

str1 = 'http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html'

print(str1[-14:-5])


字符串內建函数
str1 = 'http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html'
a = ' this is string example....wow!!! '
print(a.lstrip())
print(a.strip())
print(a.lstrip().lstrip('this'))
print(str1.rstrip('.html'))
print(str1.rstrip('.html')[-9:-1])
print(a.split())
print(a.split('i'))



https://docs.python.org/3/library/turtle.html
产生python文档的网址

for i in range(2,,10):
print('https://docs.python.org/3/library/{}.html'.format(i))



  

转载于:https://www.cnblogs.com/a13798508446/p/8599660.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值