one step further than How to implement conditional string formatting?
Basically: is it possible to add if
, elif
.... else
in a format string?
l = ['it', 'en', 'es']
for i in l:
print('{tit}'.format(tit='Ciao' if i == 'it' elif i == 'en' tit='Hi' else 'Hola'))