重要的方法:count、startwith、center、find、lower、upper、strip
print(st.count("o")) #o的个数
print(st.capitalize()) #首字母大写
print(st.center(30,"-")) #居中
print(st.endswith("pp")) #判断以什么结尾 返回boolean型
print(st.startswith("pp")) #判断以什么开头 返回boolean型
print(st.expandtabs(10)) #/t的个数
print(st.find("z")) #查找到第一个元素并返回
print(st.format(st1 = "nihao",age = 23)) #格式化输出的另一种方式 建议
print(st.format_map({'st1':'nihao','age' : 22})) #格式化输出字典型
print(st.index("z")) #类似于find 区别在于不存在该字符串 index报错 find 返回-1
print(st.isalnum()) #判断字符串是否包含数字或者字母 返回boolean型
print('213242'.isdecimal()) #判断是否为十进制 返回boolean型
print('213242.43'.isdigit()) #判断是否为像数字 整型 返回boolean型 = isnumeric()
print('213242.43'.isnumeric()) #判断是否为像数字 整型 返回boolean型
print(st.isidentifier()) #判断是否为非法变量 变量命名规则 返回boolean型
print(st.islower()) #判断是否为全部小写 返回boolean型
print(st.isupper()) #判断是否为全部大写 返回boolean型
print(' '.isspace()) #判断是否是个空格 返回boolean型
print('My Title'.istitle()) #判断是否为标题,每个单词首字母大写 返回boolean型
print(st.lower()) #大写变小写
print(st.upper()) #小写变大写
print('My Title'.swapcase()) #大写变小写,小写变大写
print('My Title'.ljust(50,'-')) #靠左
print('My Title'.rjust(50,'-')) #靠右
print(' my title '.strip()) #将开头或者结尾的空格/换行符 去掉
print(' my title '.lstrip()) #将开头的空格/换行符 去掉
print(' my title '.rstrip()) #将结尾的空格/换行符 去掉
print('hello gc'.replace('hello','hi')) #替换
print('hello gc'.rfind('l')) #从右往左 字符的真实索引位置
print('hello gc nihao'.split(' ')) #根据某个字符分割成列表
print('hello gc nihao'.rsplit('n',1)) #从左往右根据某个字符分割一次
print('hello gc nihao'.title()) #转化为标题,首字母大写
print(' '.join('12'+'45'+'34')) ```