jeudi 6 avril 2017

Python: How not NOT ADD to list comprehension in inline IF

How can I not add to the list in the else of an inline if?

For example:

somelist = somelist + (anotherlist if x==1 else ??)

in the ?? I want to NOT ADD anything without repeating somelist. I have tried [None] but that just adds a None entry to the list.

Aucun commentaire:

Enregistrer un commentaire