📅  最后修改于: 2022-03-11 14:45:10.592000             🧑  作者: Mango
my_list = [1, 2, '3', True]# We assume this list won't mutate for each example below
len(my_list) # 4
my_list.index('3') # 2
my_list.count(2) # 1 --> count how many times 2 appears
my_list[3] # True
my_list[1:] # [2, '3', True]
my_list[:1] # [1]
my_list[-1] # True
my_list[::1] # [1, 2, '3', True]
my_list[::-1] # [True, '3', 2, 1]
my_list[0:3:2] # [1, '3']
# : is called slicing and has the format [ start : end : step ]