for <var> in <sequence> if <condition>
Skip Montanaro
skip at mojam.com
Thu Oct 5 12:11:59 EDT 2000
Dave> So is there any good reason why we can't enhance the for-loop to
Dave> handle the if-condition for me? ie-
Dave> for line in lines if line.strip.startswith('y'):
Dave> doStuff(line)
What's wrong with
for line in lines:
if line.strip().startswith('y'):
doStuff(line)
?
--
Skip Montanaro (skip at mojam.com)
http://www.mojam.com/
http://www.musi-cal.com/
More information about the Python-list
mailing list