字符串操作
对字符串的操作 #String 内容 a = "Let's go" 乘法操作: print('hellow'*2) 通过索引获得字符串中字符,这里和列表的切片操作是相同的,具体内容见列表: print('hellow woeld'[2:])从位置2取到最后 成员运算符操作,字符中包含给定字符则返回True: print('e2l' in 'hello') 存在返回True 不在返回False 例如: print(123 in [12,123,1111]) 结果:True 格式化字符串: print('alex is a good teacher') print('%s is a good teacher'%'alex') 字符串的拼接: a='123' b='456' c = a+b print(c) 结果: 123456 拼接:join方法 a='123' b='abc' c='000' d = '#####'.join([a,b,c]) 结果: 123####abc####000 python内置方法: 1 #_auther_="stuwu79" 2 #date:2019/9/27 3 4 st = 'hello kitty {name} is {age}' 5 st.count("l")#计算'l'个数 6 st.capitalize()