小册名称:Python合辑2-字符串常用方法
1、Slicing
slicing切片,按照一定条件从列表或者元组中取出部分元素(比如特定范围、索引、分割值)
s = ' hello 's = s[:]print(s)# hellos = ' hello 's = s[3:8]print(s)# hello
s = ' hello '
s = s[:]
print(s)
# hello
s = s[3:8]