python字符串内置函数汇总

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python字符串内置函数汇总相关的知识,希望对你有一定的参考价值。

1.capitalize 第一个单词首字母大写

2.title 每个单词首字母大写

3.upper 每个字母变大写

4.lower 每个字母变小写

5.len() 字符串长度

6.format() 格式化  print("{}".format(‘aa‘))

7.replace替换 str.replace

8.find() 字符串查找 str.find() 返回整型

9.split 分割返回列 str=“www.96net.com.cn” str.split(‘.‘) 返回 [‘www‘,‘96net‘,‘com,‘cn‘‘]

10.join()  列表链接字符串 (":").join(str)

 

以上是关于python字符串内置函数汇总的主要内容,如果未能解决你的问题,请参考以下文章

Python内置对象汇总

python基础知识汇总

python内置方法

Python 字符串内置函数

Python内置的字符串处理函数整理

Python 内置函数