number = [0,1,2,3,5,7,8] for i in number: #第一种 print(i) for i in range(len(number)): #第二种 print(number[i]) str1 = 'abcdefg' for j in str1: print(j) for j in range(len(str1)): print(str1[j])
输出:
0
1
2
3
5
7
8
0
1
2
3
5
7
8
a
b
c
d
e
f
g
a
b
c
d
e
f
g