jeudi 16 août 2018

if any multiple condition python

I have two lists: list1 and list 2 with multiple strings

I need to test this condition: (how to proceed only when two conditions are met?) I thought the below is correct but it's not.

Currently, if one condition is met, doSomething() is executed. I want do execute doSomething() only when two conditions are met.

Does "if any" concerns two conditions?

if any (items in allbox[i].text for items in list1) 
   and (items1 in allbox[i].text for items1 in list2):
   doSomething()

Aucun commentaire:

Enregistrer un commentaire