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:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...