Python 重要的字符串处理函数

摘一些重要的字符串方法
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))
posted @ 2017-05-23 12:21  刘小伟  阅读(164)  评论(0编辑  收藏  举报