L1=['10','20','abc','Python']
print(L1)
[‘10’, ‘20’, ‘abc’, ‘Python’]
#enumerate
for i,value in enumerate(L1):
print(i,value)
0 10
1 20
2 abc
3 Python
#zip
L1=['name','age','city']
L2=['zhangsan',30,'Beijing']
list(zip(L1,L2))# 將L1和L2進行配對,List轉換成列表
[(‘name’, ‘zhangsan’), (‘age’, 30), (‘city’, ‘Beijing’)]
#正常順序
for i in range(10):
print(i)
0
1
2
3
4
5
6
7
8
9
#reverse 逆序展示
for i in reversed(range(10)):
print(i)
9
8
7
6
5
4
3
2
1
0