python 字符串常用函数

 时间:2026-02-17 08:26:48

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字符串常用方法
  • 热门搜索
    哪里回收旧衣服 朝阳旅游 怒江旅游 女太监是割哪里 tp路由器设置 苹果手机照片删除如何恢复 骶髂关节在哪里 海南旅游介绍 路由器怎么安装 深圳旅游网