jeudi 29 décembre 2016

Python: concat string if condition, else do nothing

I want to concat few strings together, and add the last one only if a boolean condition is True. Like this (a, b and c are strings):

something = a + b + (c if <condition>)

But Python does not like it. Is there a nice way to do it without the else option?

Thanks! :)

Aucun commentaire:

Enregistrer un commentaire