python中字符串用法
s = "This is a test string"
1.索引
s[0] = T
s[1] = h
2.长度
len(s) =>21
3.切片
s[0:2] =>Th
4.循环(continue 和 break)
for item in s: if item=='h': continue print(item)
s = "This is a test string"
1.索引
s[0] = T
s[1] = h
2.长度
len(s) =>21
3.切片
s[0:2] =>Th
4.循环(continue 和 break)
for item in s: if item=='h': continue print(item)