python-book
  • 目录
  • 第2章 Python基础 (旧版)
    • 2.1 上节拾遗
    • 2.2 二进制
    • 2.3 字符编码
    • 2.4 基本数据类型——数字
    • 2.5 基本数据类型——字符串
    • 2.6 基本数据类型——列表
    • 2.7 基本数据类型——元组
    • 2.8 可变、不可变数据类型和hash
    • 2.9 基本数据类型——字典
    • 2.10 基本数据类型——集合
    • 2.11 collections模块
    • 2.12 本章小结
      • 习题答案
  • 第3章 Python基础—文件操作&函数(旧版)
    • 3.1 上节拾遗
    • 3.2 三元运算
    • 3.3 字符编码转换
    • 3.4 文件处理
    • 3.5 函数
    • 3.6 函数进阶
    • 3.7 生成器&迭代器
    • 3.8 本章小节
      • 习题答案
  • 第4章 Python基础—常用模块(旧版)
    • 4.1 模块、包介绍和相关语法
    • 4.2 time & datetime 模块
    • 4.3 random 模块
    • 4.4 os 模块
    • 4.5 sys 模块
    • 4.6 shutil 模块
    • 4.7 json & pickle 模块
    • 4.8 shelve 模块
    • 4.9 xml 模块
    • 4.10 ConfigParser 模块
    • 4.11 hashlib 模块
    • 4.12 subprocess 模块
    • 4.13 logging 模块
      • python日志重复输出
    • 4.14 re 模块
    • 4.15 软件开发目录规范
    • 4.16 本章小结
      • 习题答案
  • 第5章 面向对象编程设计与开发
    • 面向对象介绍
    • 类、实例、属性、方法详解
    • 5.1 什么是面向对象的程序设计
    • 5.2 类与对象
    • 5.3 属性查找与绑定方法
    • 5.4 小结
    • 5.5 继承与派生
    • 5.6 组合
    • 5.7 抽象类
    • 5.8 多态与多态性
    • 5.9 封装
    • 5.10 绑定方法与非绑定方法
    • 5.11 内置方法
    • 5.11 内置方法(补充)
    • 5.12 元类
    • 5.13 面向对象的软件开发
    • 5.14 领域模型
    • 5.15 异常处理
    • 5.16 本章总结
  • 第6章 网络编程-SOCKET开发
    • 6.1 C/S架构介绍
    • 6.2 TCP/IP 各层详解
    • 6.3 Socket介绍
    • 6.4 Socket代码实例
    • 6.5 粘包现象与解决方案
    • 6.6 通过socket发送文件
    • 6.7 本章总结
  • 第7章 并发编程
    • 7.1 操作系统介绍
      • 附录1:操作系统介绍
    • 7.2 并发编程之多进程
      • 7.2.1 进程理论
      • 7.2.2 开启进程的两种方式
      • 7.2.3 join方法
      • 7.2.4 守护进程
      • 7.2.5 互斥锁
      • 7.2.6 队列
      • 7.2.7 生产者消费者模型
    • 7.3 并发编程之多线程
      • 7.3.1 线程理论
      • 7.3.2 开启线程的两种方式
      • 7.3.3 多线程与多进程的区别
      • 7.3.4 Thread对象的其他属性或方法
      • 7.3.5 守护线程
      • 7.4.6 GIL全局解释器锁
      • 7.4.7 死锁现象与递归锁
      • 7.4.8 信号量,Event,定时器
      • 7.4.9 线程queue
      • 7.4.10 进程池与线程池
    • 7.4 并发编程之协程
      • 7.4.1 协程介绍
      • 7.4.2 greenlet模块
      • 7.4.3 gevent模块
    • 7.5 IO模型
      • 7.5.1 IO模型介绍
      • 7.5.2 阻塞IO
      • 7.5.3 非阻塞IO
      • 7.5.4 多路复用IO
      • 7.5.5 异步IO
      • 7.5.6 IO模型比较分析
      • 7.5.7 selectors模块
    • 7.6 本章小结
  • 第8章 MySQL数据库
    • 8.1 初识数据库
      • 8.1.1 数据库管理软件的由来
      • 8.1.2 数据库概述
      • 8.1.3 mysql安装与基本管理
      • 8.1.4 初识sql语句
    • 8.2 库操作
      • 8.2.1 库的增删改查
    • 8.3 表操作
      • 8.3.1 存储引擎介绍
      • 8.3.2 表的增删改查
      • 8.3.3 数据类型
        • 1 数值类型
        • 2 日期类型
        • 3 字符串类型
        • 4 枚举类型与集合类型
      • 8.3.4 完整性约束
    • 8.4 数据操作
      • 8.4.1 数据的增删改
      • 8.4.2 单表查询
      • 8.4.3 多表查询
    • 8.5 Navicat工具与pymysql模块
      • 8.5.1 图形工具Navicat
      • 8.5.2 pymysql模块
    • 8.6 mysql内置功能
      • 8.6.1 视图
      • 8.6.2 触发器
      • 8.6.3 事务
      • 8.6.4 存储过程
      • 8.6.5 函数
      • 8.6.6 流程控制
    • 8.7 索引原理与慢查询优化
      • 8.7.1 索引原理与慢查询优化(1)
      • 8.7.2 索引原理与慢查询优化(2)
    • 8.8 本章小结
      • 8.8.1 章节作业
  • 第9章 前端开发
    • 9.0 前端内容介绍
      • 前端究竟是个什么鬼?
    • 9.1 HTML
      • 9.1.1 HTML简介
      • 9.1.2 开发环境
      • 9.1.3 HTML标签介绍
      • 9.1.4 HTML文档结构(重点)
      • 9.1.5 HTML注释
      • 9.1.6 head标签相关内容
      • 9.1.7 body标签相关内容(重点)
        • 常用标签一
        • 常用标签二
      • 9.1.8 HTML标签属性
      • 9.1.9 HTML标签分类(重点)
      • 9.1.10 标签嵌套规则(重点)
      • 9.1.11 HTML练习题
    • 9.2 CSS
      • 9.2.1 CSS介绍
      • 9.2.2 CSS语法
      • 9.2.3 CSS引入方式
      • 9.2.4 基本选择器
      • 9.2.5 组合选择器
      • 9.2.6 属性选择器
      • 9.2.7 分组选择器
      • 9.2.8 伪类选择器
      • 9.2.9 伪元素选择器
      • 9.2.10 选择器的优先级(重点)
      • 9.2.11 字体属性
      • 9.2.12 文字属性
      • 9.2.13 背景属性
      • 9.2.14 display属性(重点)
      • 9.2.15 盒模型(重点)
      • 9.2.16 浮动与清除浮动(重点)
      • 9.2.17 background属性(侧重点)
      • 9.2.18 定位(重点)
      • 9.2.19 z-index(重点)
      • 9.2.20 css练习题
    • 9.3 JavaScript
      • 9.3.1 JavaScript简介
      • 9.3.2 ECMAScript 5.0
      • 9.3.3 正则表达式
      • 9.3.4 DOM(重点)
      • 9.3.5 client、offset、scroll系列
      • 9.3.6 定时器
      • 9.3.7 BOM
      • 9.3.8 练习题
    • 9.4 jQuery
      • 9.4.1使用js的一些疼处
      • 9.4.2 js和jquery的区别
      • 9.4.3 jquery文件的引入
      • 9.4.4 jquery选择器用法
      • 9.4.5 jquery对象和DOM对象的转换
      • 9.4.6 jquery的效果
      • 9.4.7 jquery的属性操作
      • 9.4.8 操作input的value值
      • 9.4.9 jquery文档操作
      • 9.4.10 jquery的CSS
      • 9.4.11 jquery的筛选方法
      • 9.4.12 jquery的事件
      • 9.4.13 jquery的Ajax
      • 9.4.14 补充内容
      • 9.4.15 练习题
    • 9.5 Bootstrap
      • 9.5.1 Bootstrap的介绍和响应式@metia媒体查询
      • 9.5.2 Bootstrap的引入和使用
      • 9.5.3 Bootstrap插件的一些常用属性介绍
    • 9.6 前端内容流程导图
  • 第10章 Django
    • 10.1 web应用与http协议
      • 10.1.1 web应用与web框架
    • 10.2 http协议简介
    • 10.3 Django简介
    • 10.4 Django-2的路由层(URLconf)
    • 10.5 Django的视图层
    • 10.6 Django模板层
    • 10.7 Django模型层
      • 模型层一单表操作
      • 模型层二多表操作
    • 10.8 Django组件-cookie与session
    • 10.9 Django组件-forms组件
    • 10.10 Django组件-用户认证
    • 10.11 Django组件-中间件
    • 10.12 Django组件-分页器
    • 10.13 Django与Ajax
    • 10.14习题
  • 第11章 BBS项目(博客系统)
    • 11.1 基于Ajax和用户认证系统的登录验证
    • 11.2 基于Ajax和forms组件的实现注册功能
    • 11.3 系统首页的布局渲染
    • 11.4 个人站点的文章,标签,分类查询
    • 11.5 文章详细页的设计
    • 11.6 点赞与踩灭功能的实现
    • 11.7 评论功能的实现
    • 11.8 基于富文本编辑器框和beautifulSoup模块防止xss攻击
  • 第12章 CRM项目
    • 12.1 权限组件之权限控制
  • 第1章 Python基础(旧版)
    • 1.1 编程语言介绍
    • 1.2 Python介绍
    • 1.3 Python安装
    • 1.4 第一个Python程序
    • 1.5 变量
    • 1.6 程序交互
    • 1.7 基本数据类型
    • 1.8 格式化输出
    • 1.9 基本运算符
    • 1.10 流程控制之 if ... else
    • 1.11 流程控制之 循环
    • 1.12 开发工具IDE
    • 1.13 本章小节
      • 习题答案
    • 1.14 Python开发规范指南
      • 1.14.1 Python风格规范
      • 1.14.2 Python语言规范
  • 第1章 Python基础语法(new)
    • 1.1 编程语言介绍与分类
    • 1.2 Python介绍、发展趋势
    • 1.3 Python环境安装
    • 1.4 开发你的第一个Python程序
    • 1.5 选择最好用的PyCharm IDE
    • 1.6 变量
    • 1.7 注释
    • 1.8 基本数据类型
    • 1.9 读取用户指令
    • 1.10 格式化打印
    • 1.11 运算符
    • 1.12 流程控制之if...else
    • 1.13 流程控制之while循环
    • 1.14 本章练习题&作业
  • 第2章 Python基础-数据类型和文件操作(new)
    • 2.1 上章补充-Bytes类型
  • 第3章 Python基础-函数编程(new)
  • 第4章 Python基础 常用模块(new)
Powered by GitBook
On this page
  • 本节重点
  • 字符串的定义与创建
  • 字符串的特性与常用操作
  • 字符串的工厂函数

Was this helpful?

  1. 第2章 Python基础 (旧版)

2.5 基本数据类型——字符串

Previous2.4 基本数据类型——数字Next2.6 基本数据类型——列表

Last updated 5 years ago

Was this helpful?

本节重点

1.让学员理解字符串数据类型出现的意义

2.让学员掌握字符串的定义和特性

3.学员能熟练掌握字符串常用操作,并了解其他工厂方法

4.教会学生看源码技能

字符串的定义与创建

字符串是一个有序的字符的集合,用于存储和表示基本的文本信息,' '或'' ''或''' '''中间包含的内容称之为字符串

创建:

 s = 'Hello,Eva!How are you?'

字符串的特性与常用操作

特性:

1.按照从左到右的顺序定义字符集合,下标从0开始顺序访问,有序

补充:

1.字符串的单引号和双引号都无法取消特殊字符的含义,如果想让引号内所有字符均取消特殊意义,在引号前面加r,如name=r'l\thf'

2.unicode字符串与r连用必需在r前面,如name=ur'l\thf'

常用操作:

#索引
s = 'hello'
>>> s[1]
'e'
>>> s[-1]
'o'


>>> s.index('e')
1


#查找
>>> s.find('e')
1
>>> s.find('i')
-1


#移除空白
s = '  hello,world!  '
s.strip()
s.lstrip()
s.rstrip()
s2 = '***hello,world!***'
s2.strip('*')

#长度
>>> s = 'hello,world'
>>> len(s)
11

#替换
>>> s = 'hello world'
>>> s.replace('h','H')
'Hello world'
>>> s2 = 'hi,how are you?'
>>> s2.replace('h','H')
'Hi,How are you?'

#切片
>>> s = 'abcdefghigklmn'
>>> s[0:7]
'abcdefg'
>>> s[7:14]
'higklmn'
>>> s[:7]
'abcdefg'
>>> s[7:]
'higklmn'
>>> s[:]
'abcdefghigklmn'
>>> s[0:7:2]
'aceg'
>>> s[7:14:3]
'hkn'
>>> s[::2]
'acegikm'
>>> s[::-1]
'nmlkgihgfedcba'

字符串的工厂函数

教会学员看源码

class str(object):
    """
    str(object='') -> str
    str(bytes_or_buffer[, encoding[, errors]]) -> str

    Create a new string object from the given object. If encoding or
    errors is specified, then the object must expose a data buffer
    that will be decoded using the given encoding and error handler.
    Otherwise, returns the result of object.__str__() (if defined)
    or repr(object).
    encoding defaults to sys.getdefaultencoding().
    errors defaults to 'strict'.
    """
    def capitalize(self): # real signature unknown; restored from __doc__
        """
        首字母变大写
        S.capitalize() -> str

        Return a capitalized version of S, i.e. make the first character
        have upper case and the rest lower case.
        """
        return ""

    def casefold(self): # real signature unknown; restored from __doc__
        """
        S.casefold() -> str

        Return a version of S suitable for caseless comparisons.
        """
        return ""

    def center(self, width, fillchar=None): # real signature unknown; restored from __doc__
        """
        原来字符居中,不够用空格补全
        S.center(width[, fillchar]) -> str

        Return S centered in a string of length width. Padding is
        done using the specified fill character (default is a space)
        """
        return ""

    def count(self, sub, start=None, end=None): # real signature unknown; restored from __doc__
        """
         从一个范围内的统计某str出现次数
        S.count(sub[, start[, end]]) -> int

        Return the number of non-overlapping occurrences of substring sub in
        string S[start:end].  Optional arguments start and end are
        interpreted as in slice notation.
        """
        return 0

    def encode(self, encoding='utf-8', errors='strict'): # real signature unknown; restored from __doc__
        """
        encode(encoding='utf-8',errors='strict')
        以encoding指定编码格式编码,如果出错默认报一个ValueError,除非errors指定的是
        ignore或replace

        S.encode(encoding='utf-8', errors='strict') -> bytes

        Encode S using the codec registered for encoding. Default encoding
        is 'utf-8'. errors may be given to set a different error
        handling scheme. Default is 'strict' meaning that encoding errors raise
        a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
        'xmlcharrefreplace' as well as any other name registered with
        codecs.register_error that can handle UnicodeEncodeErrors.
        """
        return b""

    def endswith(self, suffix, start=None, end=None): # real signature unknown; restored from __doc__
        """
        S.endswith(suffix[, start[, end]]) -> bool

        Return True if S ends with the specified suffix, False otherwise.
        With optional start, test S beginning at that position.
        With optional end, stop comparing S at that position.
        suffix can also be a tuple of strings to try.
        """
        return False

    def expandtabs(self, tabsize=8): # real signature unknown; restored from __doc__
        """
        将字符串中包含的\t转换成tabsize个空格
        S.expandtabs(tabsize=8) -> str

        Return a copy of S where all tab characters are expanded using spaces.
        If tabsize is not given, a tab size of 8 characters is assumed.
        """
        return ""

    def find(self, sub, start=None, end=None): # real signature unknown; restored from __doc__
        """
        S.find(sub[, start[, end]]) -> int

        Return the lowest index in S where substring sub is found,
        such that sub is contained within S[start:end].  Optional
        arguments start and end are interpreted as in slice notation.

        Return -1 on failure.
        """
        return 0

    def format(self, *args, **kwargs): # known special case of str.format
        """
        格式化输出
        三种形式:
        形式一.
        >>> print('{0}{1}{0}'.format('a','b'))
        aba

        形式二:(必须一一对应)
        >>> print('{}{}{}'.format('a','b'))
        Traceback (most recent call last):
          File "<input>", line 1, in <module>
        IndexError: tuple index out of range
        >>> print('{}{}'.format('a','b'))
        ab

        形式三:
        >>> print('{name} {age}'.format(age=12,name='lhf'))
        lhf 12

        S.format(*args, **kwargs) -> str

        Return a formatted version of S, using substitutions from args and kwargs.
        The substitutions are identified by braces ('{' and '}').
        """
        pass

    def format_map(self, mapping): # real signature unknown; restored from __doc__
        """
        与format区别
        '{name}'.format(**dict(name='alex'))
        '{name}'.format_map(dict(name='alex'))

        S.format_map(mapping) -> str

        Return a formatted version of S, using substitutions from mapping.
        The substitutions are identified by braces ('{' and '}').
        """
        return ""

    def index(self, sub, start=None, end=None): # real signature unknown; restored from __doc__
        """
        S.index(sub[, start[, end]]) -> int

        Like S.find() but raise ValueError when the substring is not found.
        """
        return 0

    def isalnum(self): # real signature unknown; restored from __doc__
        """
        至少一个字符,且都是字母或数字才返回True

        S.isalnum() -> bool

        Return True if all characters in S are alphanumeric
        and there is at least one character in S, False otherwise.
        """
        return False

    def isalpha(self): # real signature unknown; restored from __doc__
        """
        至少一个字符,且都是字母才返回True
        S.isalpha() -> bool

        Return True if all characters in S are alphabetic
        and there is at least one character in S, False otherwise.
        """
        return False

    def isdecimal(self): # real signature unknown; restored from __doc__
        """
        S.isdecimal() -> bool

        Return True if there are only decimal characters in S,
        False otherwise.
        """
        return False

    def isdigit(self): # real signature unknown; restored from __doc__
        """
        S.isdigit() -> bool

        Return True if all characters in S are digits
        and there is at least one character in S, False otherwise.
        """
        return False

    def isidentifier(self): # real signature unknown; restored from __doc__
        """
        字符串为关键字返回True

        S.isidentifier() -> bool

        Return True if S is a valid identifier according
        to the language definition.

        Use keyword.iskeyword() to test for reserved identifiers
        such as "def" and "class".
        """
        return False

    def islower(self): # real signature unknown; restored from __doc__
        """
        至少一个字符,且都是小写字母才返回True
        S.islower() -> bool

        Return True if all cased characters in S are lowercase and there is
        at least one cased character in S, False otherwise.
        """
        return False

    def isnumeric(self): # real signature unknown; restored from __doc__
        """
        S.isnumeric() -> bool

        Return True if there are only numeric characters in S,
        False otherwise.
        """
        return False

    def isprintable(self): # real signature unknown; restored from __doc__
        """
        S.isprintable() -> bool

        Return True if all characters in S are considered
        printable in repr() or S is empty, False otherwise.
        """
        return False

    def isspace(self): # real signature unknown; restored from __doc__
        """
        至少一个字符,且都是空格才返回True
        S.isspace() -> bool

        Return True if all characters in S are whitespace
        and there is at least one character in S, False otherwise.
        """
        return False

    def istitle(self): # real signature unknown; restored from __doc__
        """
        >>> a='Hello'
        >>> a.istitle()
        True
        >>> a='HellP'
        >>> a.istitle()
        False

        S.istitle() -> bool

        Return True if S is a titlecased string and there is at least one
        character in S, i.e. upper- and titlecase characters may only
        follow uncased characters and lowercase characters only cased ones.
        Return False otherwise.
        """
        return False

    def isupper(self): # real signature unknown; restored from __doc__
        """
        S.isupper() -> bool

        Return True if all cased characters in S are uppercase and there is
        at least one cased character in S, False otherwise.
        """
        return False

    def join(self, iterable): # real signature unknown; restored from __doc__
        """
        #对序列进行操作(分别使用' '与':'作为分隔符)
        >>> seq1 = ['hello','good','boy','doiido']
        >>> print ' '.join(seq1)
        hello good boy doiido
        >>> print ':'.join(seq1)
        hello:good:boy:doiido


        #对字符串进行操作

        >>> seq2 = "hello good boy doiido"
        >>> print ':'.join(seq2)
        h:e:l:l:o: :g:o:o:d: :b:o:y: :d:o:i:i:d:o


        #对元组进行操作

        >>> seq3 = ('hello','good','boy','doiido')
        >>> print ':'.join(seq3)
        hello:good:boy:doiido


        #对字典进行操作

        >>> seq4 = {'hello':1,'good':2,'boy':3,'doiido':4}
        >>> print ':'.join(seq4)
        boy:good:doiido:hello


        #合并目录

        >>> import os
        >>> os.path.join('/hello/','good/boy/','doiido')
        '/hello/good/boy/doiido'


        S.join(iterable) -> str

        Return a string which is the concatenation of the strings in the
        iterable.  The separator between elements is S.
        """
        return ""

    def ljust(self, width, fillchar=None): # real signature unknown; restored from __doc__
        """
        S.ljust(width[, fillchar]) -> str

        Return S left-justified in a Unicode string of length width. Padding is
        done using the specified fill character (default is a space).
        """
        return ""

    def lower(self): # real signature unknown; restored from __doc__
        """
        S.lower() -> str

        Return a copy of the string S converted to lowercase.
        """
        return ""

    def lstrip(self, chars=None): # real signature unknown; restored from __doc__
        """
        S.lstrip([chars]) -> str

        Return a copy of the string S with leading whitespace removed.
        If chars is given and not None, remove characters in chars instead.
        """
        return ""

    def maketrans(self, *args, **kwargs): # real signature unknown
        """
        Return a translation table usable for str.translate().

        If there is only one argument, it must be a dictionary mapping Unicode
        ordinals (integers) or characters to Unicode ordinals, strings or None.
        Character keys will be then converted to ordinals.
        If there are two arguments, they must be strings of equal length, and
        in the resulting dictionary, each character in x will be mapped to the
        character at the same position in y. If there is a third argument, it
        must be a string, whose characters will be mapped to None in the result.
        """
        pass

    def partition(self, sep): # real signature unknown; restored from __doc__
        """
        以sep为分割,将S分成head,sep,tail三部分

        S.partition(sep) -> (head, sep, tail)

        Search for the separator sep in S, and return the part before it,
        the separator itself, and the part after it.  If the separator is not
        found, return S and two empty strings.
        """
        pass

    def replace(self, old, new, count=None): # real signature unknown; restored from __doc__
        """
        S.replace(old, new[, count]) -> str

        Return a copy of S with all occurrences of substring
        old replaced by new.  If the optional argument count is
        given, only the first count occurrences are replaced.
        """
        return ""

    def rfind(self, sub, start=None, end=None): # real signature unknown; restored from __doc__
        """
        S.rfind(sub[, start[, end]]) -> int

        Return the highest index in S where substring sub is found,
        such that sub is contained within S[start:end].  Optional
        arguments start and end are interpreted as in slice notation.

        Return -1 on failure.
        """
        return 0

    def rindex(self, sub, start=None, end=None): # real signature unknown; restored from __doc__
        """
        S.rindex(sub[, start[, end]]) -> int

        Like S.rfind() but raise ValueError when the substring is not found.
        """
        return 0

    def rjust(self, width, fillchar=None): # real signature unknown; restored from __doc__
        """
        S.rjust(width[, fillchar]) -> str

        Return S right-justified in a string of length width. Padding is
        done using the specified fill character (default is a space).
        """
        return ""

    def rpartition(self, sep): # real signature unknown; restored from __doc__
        """
        S.rpartition(sep) -> (head, sep, tail)

        Search for the separator sep in S, starting at the end of S, and return
        the part before it, the separator itself, and the part after it.  If the
        separator is not found, return two empty strings and S.
        """
        pass

    def rsplit(self, sep=None, maxsplit=-1): # real signature unknown; restored from __doc__
        """
        S.rsplit(sep=None, maxsplit=-1) -> list of strings

        Return a list of the words in S, using sep as the
        delimiter string, starting at the end of the string and
        working to the front.  If maxsplit is given, at most maxsplit
        splits are done. If sep is not specified, any whitespace string
        is a separator.
        """
        return []

    def rstrip(self, chars=None): # real signature unknown; restored from __doc__
        """
        S.rstrip([chars]) -> str

        Return a copy of the string S with trailing whitespace removed.
        If chars is given and not None, remove characters in chars instead.
        """
        return ""

    def split(self, sep=None, maxsplit=-1): # real signature unknown; restored from __doc__
        """
        以sep为分割,将S切分成列表,与partition的区别在于切分结果不包含sep,
        如果一个字符串中包含多个sep那么maxsplit为最多切分成几部分
        >>> a='a,b c\nd\te'
        >>> a.split()
        ['a,b', 'c', 'd', 'e']
        S.split(sep=None, maxsplit=-1) -> list of strings

        Return a list of the words in S, using sep as the
        delimiter string.  If maxsplit is given, at most maxsplit
        splits are done. If sep is not specified or is None, any
        whitespace string is a separator and empty strings are
        removed from the result.
        """
        return []

    def splitlines(self, keepends=None): # real signature unknown; restored from __doc__
        """
        Python splitlines() 按照行('\r', '\r\n', \n')分隔,
        返回一个包含各行作为元素的列表,如果参数 keepends 为 False,不包含换行符,如        果为 True,则保留换行符。
        >>> x
        'adsfasdf\nsadf\nasdf\nadf'
        >>> x.splitlines()
        ['adsfasdf', 'sadf', 'asdf', 'adf']
        >>> x.splitlines(True)
        ['adsfasdf\n', 'sadf\n', 'asdf\n', 'adf']

        S.splitlines([keepends]) -> list of strings

        Return a list of the lines in S, breaking at line boundaries.
        Line breaks are not included in the resulting list unless keepends
        is given and true.
        """
        return []

    def startswith(self, prefix, start=None, end=None): # real signature unknown; restored from __doc__
        """
        S.startswith(prefix[, start[, end]]) -> bool

        Return True if S starts with the specified prefix, False otherwise.
        With optional start, test S beginning at that position.
        With optional end, stop comparing S at that position.
        prefix can also be a tuple of strings to try.
        """
        return False

    def strip(self, chars=None): # real signature unknown; restored from __doc__
        """
        S.strip([chars]) -> str

        Return a copy of the string S with leading and trailing
        whitespace removed.
        If chars is given and not None, remove characters in chars instead.
        """
        return ""

    def swapcase(self): # real signature unknown; restored from __doc__
        """
        大小写反转
        S.swapcase() -> str

        Return a copy of S with uppercase characters converted to lowercase
        and vice versa.
        """
        return ""

    def title(self): # real signature unknown; restored from __doc__
        """
        S.title() -> str

        Return a titlecased version of S, i.e. words start with title case
        characters, all remaining cased characters have lower case.
        """
        return ""

    def translate(self, table): # real signature unknown; restored from __doc__
        """
        table=str.maketrans('alex','big SB')

        a='hello abc'
        print(a.translate(table))

        S.translate(table) -> str

        Return a copy of the string S in which each character has been mapped
        through the given translation table. The table must implement
        lookup/indexing via __getitem__, for instance a dictionary or list,
        mapping Unicode ordinals to Unicode ordinals, strings, or None. If
        this operation raises LookupError, the character is left untouched.
        Characters mapped to None are deleted.
        """
        return ""

    def upper(self): # real signature unknown; restored from __doc__
        """
        S.upper() -> str

        Return a copy of S converted to uppercase.
        """
        return ""

    def zfill(self, width): # real signature unknown; restored from __doc__
        """
        原来字符右对齐,不够用0补齐

        S.zfill(width) -> str

        Pad a numeric string S with zeros on the left, to fill a field
        of the specified width. The string S is never truncated.
        """
        return ""

     ...略...