for循环用于对集合进行迭代处理,标准语法:
for value in collection
#对value进行一些处理
if ...continue
a=[1,2,None,4,None,5]
total = 0
for value in a:
if value is None:
continue
total = total+value
print total
12
for循环用于对集合进行迭代处理,标准语法:
for value in collection
#对value进行一些处理
if ...continue
a=[1,2,None,4,None,5]
total = 0
for value in a:
if value is None:
continue
total = total+value
print total
12