lundi 1 août 2016

One-liner to save value of if statement?

Is there a smart way to write the following code in three or four lines?

a=l["artist"]
if a:
    b=a["projects"]
    if b:
        c=b["project"]
        if c:
            print c

So I thought for something like pseudocode:

a = l["artist"] if True:

Aucun commentaire:

Enregistrer un commentaire