字符串常用的方法

#摘一些重要的字符串方法
#1 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(' My tLtle '.strip())
# print('My title title'.replace('itle','lesson',1))
# print('My title title'.split('i',1))

a='123'
b='abc'
d='44'
c=a+b
print(c)

c= ''.join([a,b,d])
print(c)#123abc44
原文地址:https://www.cnblogs.com/lokerx/p/10708757.html