list iteration if statement
Mensanator
mensanator at aol.com
Fri Jan 2 22:23:17 EST 2009
On Jan 2, 8:43�pm, "alex goretoy" <aleksandr.gore... at gmail.com> wrote:
> rather, how do I suppress the output of the list with all None in it?
>
> >>> l=[['3'], ['0', '4'], ['0', '1'], ['0']]
> >>> v=[]
> >>> [[v.append(j)for j in i if j != "0"] for i in l]
>
> [[None], [None], [None], []]
>
> >>> v
> ['39', '32', '1']
>
Assign it to something.
>>> ignore_me = [[v.append(j)for j in i if j != "0"] for i in l]
>>> v
['3', '4', '1']
More information about the Python-list
mailing list