I want to know if I can add a conditional statement as part of a for in loop. For example if I have the following situation:
nameList = [person.name for person in Persons.query.filter_by(category='Admin').all()]
I want to add another statement such that only add to nameList if person.id is not in another list called 'blackListedIDs'
Aucun commentaire:
Enregistrer un commentaire