for

indexを得るにはenumerateを使うnames=['a','b','c','d']for index, name in enumerate(names): print(index,name)
zipを使って複数のリストのループをまとめることができる.例)lons=[320, 330, 80, 130]lats=[ 45, 70, 65, 40]for (lon,lat) in zip(lons,lats): print lon,lat
enumerateとzipを組み合わせることができるfor ind,(lat,lon) in enumerate(zip(lats,lons)):
breakをループ中で呼ぶと,そこでループを抜けるcontinueをループ中で呼ぶと,ループの後の処理をせずにループの頭に戻る
vars=['T', 'U', 'V', 'Z3']for var in vars: ....for no in range(0, 10) # 0-9のループ.rangeは,初期値から最終値未満であることに注意.

vars=['T', 'U', 'V', 'Z3']

for var in vars:

....

for no in range(0, 10) # Loop for 0-9.Note that range is from the initial value to a value smaller than the final value.

If there is "break" in the loop, loop ends at that point.

If there is "continue" in the loop, procedure returns to the begining of the loop without processing the rest of the loop.

You can combine multiple lists into one for loop using "zip"

Example:

lons=[320, 330, 80, 130]

lats=[ 45, 70, 65, 40]

for (lon,lat) in zip(lons,lats):

print lon,lat

In order to get index, use enumerate as

names=['a','b','c','d']

for index, name in enumerate(names):

print(index,name)