zoukankan      html  css  js  c++  java
  • 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))


    
    

      

  • 相关阅读:
    Stl源码剖析读书笔记之Alloc细节
    Lua热更系统
    Linux C++线程池
    linux sort,uniq,cut,wc.
    (转)Linux grep
    用LogParser分析IIS请求压力
    (转)MySQL主从复制的常见拓扑、原理分析以及如何提高主从复制的效率总
    AIS相关资料
    python学习笔记
    (转)MySQL InnoDB修复笔记
  • 原文地址:https://www.cnblogs.com/a13798508446/p/8599660.html
Copyright © 2011-2022 走看看