python 字符串常用函数

 时间:2026-04-26 02:38:10

1、新建一个python脚本文件名为test.py(名字任意)

python 字符串常用函数

2、capitalize()将字符串首字母变成大写

python 字符串常用函数

3、mes.title()将每个单词的首字母变成大写

python 字符串常用函数

4、len()获取字符串长度

python 字符串常用函数

5、find()查找字符串中是否包含某个字符串,-1表示没有找到,其它值表示找到且是该字符串第一次出现的位置

python 字符串常用函数

6、replace()将字符串中的字符替换成给定的字符串

python 字符串常用函数

7、startwith()以...开头,endwith以...结尾

python 字符串常用函数

8、join()使用指定符合进行字符串拼接,split()字符串分割,分割后的结果保存到列表中

python 字符串常用函数

python 字符串常用函数

  • python random模块常用函数
  • python中的常用数据类型
  • python的字符串format函数
  • python字符串查找函数的使用
  • python字符串常用方法
  • 热门搜索
    带状疱疹怎么治疗最快 怎么做糖葫芦 qq怎么盗号 牛仔裤怎么洗 百分之几怎么算 市场占有率怎么算 基金怎么算收益 净资产怎么算 大便出血怎么办 淘宝退货怎么退