lundi 3 avril 2017

How to add else in python

I have some troubles with next statement:

 for i in (i for i, tr in enumerate(demo['tracks']) if c in tr['title']):
     print(i)

It works as it should, but how to add else, when c is not in tr['title']

Aucun commentaire:

Enregistrer un commentaire