# 通过索引 s1 = 'hello world' print(s1[0]) print(s1[2]) # 分片 print(s1[6:9]) print(s1[6:]) print(s1[::2]) print(s1[::-1]) # 乘法 s2 = 'xyz' print(10 * s2) print(s2 * 10) print('b' in s2) print('y' in s2) print('b' not in s2) print(len(s1)) print(min(s2)) print(max(s2)) a = [1,2,3,0,6] print(2 in a) print(len(a)) print(min(a)) print(max(a)) print(10 * a) a[0] = 20 # 字符串相当于由字符组成的元组
h
l
wor
world
hlowrd
dlrow olleh
xyzxyzxyzxyzxyzxyzxyzxyzxyzxyz
xyzxyzxyzxyzxyzxyzxyzxyzxyzxyz
False
True
True
11
x
z
True
5
0
6
[1, 2, 3, 0, 6, 1, 2, 3, 0, 6, 1, 2, 3, 0, 6, 1, 2, 3, 0, 6, 1, 2, 3, 0, 6, 1, 2, 3, 0, 6, 1, 2, 3, 0, 6, 1, 2, 3, 0, 6, 1, 2, 3, 0, 6, 1, 2, 3, 0, 6]