📜  python for 循环与数组 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:08.264000             🧑  作者: Mango

代码示例1
foo = ['foo', 'bar']
for i in foo:
  print(i) #outputs 'foo' then 'bar'
for i in range(len(foo)):
  print(foo[i]) #outputs 'foo' then 'bar'
i = 0
while i < len(foo):
  print(foo[i]) #outputs 'foo' then 'bar'