python for语句

for eachNum in [0, 1, 2]:
    print(eachNum)

#range()内建函数生成0 1 2...   
for eachNum in range(3):
    print(eachNum)
    
foo = 'abc'
for c in foo:
    print(c)
 
 
 
输出:
 

0
1
2
0
1
2
a
b
c

posted @ 2013-03-04 13:50  helloweworld  阅读(176)  评论(0编辑  收藏  举报