samedi 7 mars 2015

how to represent nested 'if' to one line python comprehension

I have a logic:



dic = {.....}
if x in dic:
do sth
else:
dic[x] = 0
do sth (same as previous)


how can I change this logic to one line comprehension?


Aucun commentaire:

Enregistrer un commentaire