Thursday

python sum of list/array and any all


::accumulators
def countall(it):return sum(1 for x in it )
if any(x>5 for x in xs): ...
if all(x>y>z for x,y,z in zip(xs,ys,ys)):

from itertools import izip
if all(x>y>z for x,y,z in izip(xs,ys,zs)):

print max(i for i, x in enumerate(xs) if x > 0)

with operator:
with open('myfile.txt') as f:
for aline in f: print alien[3]


more...

No comments:

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...