[Tutor] if in an iteration, quick Q!!

Alan Gauld alan.gauld at btinternet.com
Tue May 1 16:53:24 CEST 2007

"John Washakie" <washakie at gmail.com> wrote 

> Therefore I want to be able to say:
> a = [int(x) for x in tmp IF x in tmp]

x will always be in tmp - thats where it comes from!
You want to check if its non null.

a = [int(x) for x in tmp if x]

Alan G

More information about the Tutor mailing list