IT入门 > 教程 > python >
  • Python3 min()方法 日期:2022-09-11 点击:10031 python

    描述 Python min() 方法返回字符串中最小的字母。 语法 min()方法语法: min(str) 参数 str -- 字符串。 返回值 返回字符串中最小的字母。 实例 以下实例展示了min()函数的使用方法: 实例 #...

  • Python3 replace()方法 日期:2022-09-11 点击:5705 python

    描述 replace() 方法把字符串中的 old(旧字符串) 替换成 new(新字符串),如果指定第三个参数max,则替换不超过 max 次。 语法 replace()方法语法: str.replace(old, new[, max]) 参数 old -- 将被替换...

  • Python3 rfind()方法 日期:2022-09-11 点击:8025 python

    描述 Python rfind() 返回字符串最后一次出现的位置,如果没有匹配项则返回-1。 语法 rfind()方法语法: str.rfind(str, beg=0 end=len(string)) 参数 str -- 查找的字符串 beg -- 开始查找的位置,默认为...

  • Python3 rindex()方法 日期:2022-09-11 点击:5341 python

    描述 rindex() 返回子字符串 str 在字符串中最后出现的位置,如果没有匹配的字符串会报异常,你可以指定可选参数[beg:end]设置查找的区间。 语法 rindex()方法语法: str.rindex(str, beg=0 end...

  • Python3 rjust()方法 日期:2022-09-11 点击:4967 python

    描述 rjust() 返回一个原字符串右对齐,并使用空格填充至长度 width 的新字符串。如果指定的长度小于字符串的长度则返回原字符串。 语法 rjust()方法语法: str.rjust(width[, fillchar]) 参数...

  • Python3 rstrip() 方法 日期:2022-09-11 点击:7958 python

    描述 rstrip() 删除 string 字符串末尾的指定字符,默认为空白符,包括空格、换行符、回车符、制表符。 语法 rstrip()方法语法: str.rstrip([chars]) 参数 chars -- 指定删除的字符(默认为空白...

  • Python3 split()方法 日期:2022-09-11 点击:4217 python

    描述 split() 通过指定分隔符对字符串进行切片,如果第二个参数 num 有指定值,则分割为 num+1 个子字符串。 语法 split() 方法语法: str.split(str="", num=string.count(str)) 参数 str -- 分隔符,默...

  • Python3 splitlines()方法 日期:2022-09-11 点击:6579 python

    描述 Python splitlines() 按照行('\r', '\r\n', \n')分隔,返回一个包含各行作为元素的列表,如果参数 keepends 为 False,不包含换行符,如果为 True,则保留换行符。 语法 splitlines()方法语法:...

  • Python3 startswith()方法 日期:2022-09-11 点击:3171 python

    描述 startswith() 方法用于检查字符串是否是以指定子字符串开头,如果是则返回 True,否则返回 False。如果参数 beg 和 end 指定值,则在指定范围内检查。 语法 startswith()方法语法: str....

  • Python3 strip()方法 日期:2022-09-11 点击:6537 python

    描述 Python strip() 方法用于移除字符串头尾指定的字符(默认为空格)或字符序列。 注意: 该方法只能删除开头或是结尾的字符,不能删除中间部分的字符。 语法 strip()方法语法: st...