zoukankan      html  css  js  c++  java
  • 字符串练习

    字符串练习:

    http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html

    取得校园新闻的编号

    str='http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html'
    str.rstrip('.html').split('/')[-1]

    https://docs.python.org/3/library/turtle.html

    产生python文档的网址

    str='https://docs.python.org/3/library/turtle.html'
    print(str)

    http://news.gzcc.cn/html/xiaoyuanxinwen/4.html

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

    for i in range(10):
        str='http://news.gzcc.cn/html/xiaoyuanxinwen/{}.html'.format(i)
        print(str)

    练习字符串内建函数:strip,lstrip,rstrip,split,count

    用函数得到校园新闻编号

    用函数统计一歌词中单词出现的次数

    将字符串分解成一个个的单词。

    复制代码
    str='''
    起来!不愿做奴隶的人们!
    把我们的血肉筑成我们新的长城!
    中华民族到了最危险的时候,
    每个人被迫着发出最后的吼声。
    起来!起来!起来!
    我们万众一心,
    冒着敌人的炮火,前进!
    冒着敌人的炮火,前进!
    前进!前进、进!
    '''
    print(str.count('前进'))
  • 相关阅读:
    02.jwt单点登录
    04.RBAC
    COM interop
    C++、c#互调用之VC6 调用 VC6 COM
    Type Library Importer (Tlbimp.exe)
    C++、C#互调用之C++ 调用C# dll
    VS tools
    Type Library to Assembly 转换摘要
    7个顶级心理预言
    c++、C#互调用之c# 调用 vc6 COM
  • 原文地址:https://www.cnblogs.com/Molemole/p/8613212.html
Copyright © 2011-2022 走看看