dimanche 13 octobre 2019

Python - How to check multiply strings matches one string [duplicate]

This question already has an answer here:

The problem is pretty simple yet hard for me to understand what I am doing wrong.

So what I have done is pretty simple:

productTags = ['METALLIC SILVER', 'SB DUNK LOW', 'SUPREME', 'BLACK'] #This value is random but this is ie. only. 

#productTags = ['AIR MAX', 'AIR MAX 90', 'BEHIND THE DESIGN', 'BIO BEIGE', 'NEW SPECIES', 'ELECTRIC GREEN']

if productTags and 'BEHIND THE DESIGN' or 'INSIDE THE VAULT' or'INSIDE THE VAULT' in productTags:
     print("Matches!!")
else:
     print("No match!!")

and the problem is here that it does seems to go into the if-statement all the time even though it doesn't matches and I am curious how I can possible be able to have all these strings 'BEHIND THE DESIGN' or 'INSIDE THE VAULT' or'INSIDE THE VAULT' to be see if it matches with productTags. How am I able to do that?

Aucun commentaire:

Enregistrer un commentaire