列表的表示格式:
list of integers = [1, 2, 3, 8, 33]
除了这里调用的integers,还可以调用别的一些函数。
反转列表:
类别1——遍历
比如给大家演示一个列表
list = [10, 20, 30, 40, 50, 60, 70].
代码实现遍历如下:
for elem in list: elem = elem + 5 print(elem)
类别2——切片
list[:] = [3, 22, 30, 5.3, 20] (all the members of the list];
上一篇:python3中如何构造字典
下一篇:python列表怎么求平均值