python中str的索引、切片

it2026-05-10  6

python中str的索引、切片 1 a = "hello" 2 a1 = a[1] 3 a2 = a[0:2] 4 print(a1) 5 print(a2)

我们通过索引获取字符串中指定位数的字符

通过切片获取指定区间范围的所有字符 范围大于等于开始小于末尾

posted on 2019-04-09 10:07 恒笛 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/xwqhl/p/10675179.html

最新回复(0)