Python 重要的字符串处理函数

来源:互联网 发布:映客直播源码 编辑:程序博客网 时间:2024/06/05 05:52
摘一些重要的字符串方法print(st.count('l'))print(st.center(50,'#'))   #  居中print(st.startswith('he')) #  判断是否以某个内容开头print(st.find('t'))print(st.format(name='alex',age=37))  # 格式化输出的另一种方式   待定:?:{}print('My tLtle'.lower())print('My tLtle'.upper())print('\tMy tLtle\n'.strip())print('My title title'.replace('itle','lesson',1))print('My title title'.split('i',1))