str.capitalize():把字符串的第一个字符大写

str.casefold():把字符串全改小写

str.center(width):把字符串居中,并用空格填充至width宽度

str.count('xi'):查找字符xi出现的次数

str.endwith('xi'):检查字符是否以xi结尾

str.expandtabs():把字符串中的tab转为8个空格

str.find(xi):查找字符xi的位置,找不到返回-1

str.join('12345'):以12345分隔字符串

str.lstrip():去掉字符串左边的空格

str.partition('ov'):把字符串以ov分隔,作为元组

str.replace('old','new'):把str的old字符替换为new

str.split('xi'):找到xi就切,切成列表,默然以空格切

str.strip():删除左边和右边的空格

str.swapcase():把大写变小写,小写变大写

str.translate()

python的字符串

 

python的字符串

python的字符串

format函数

python的字符串

python的字符串

python的字符串

python的字符串

python的字符串

python的字符串

 

 

相关文章:

  • 2021-11-24
  • 2021-08-28
  • 2021-11-10
  • 2021-09-10
猜你喜欢
  • 2021-07-22
  • 2022-02-14
  • 2022-12-23
  • 2021-10-18
相关资源
相似解决方案