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)
标签:style 分享 open int item close pytho 用法 color
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)
标签:style 分享 open int item close pytho 用法 color
原文地址:https://www.cnblogs.com/pipi-vincent/p/8329602.html