dimanche 29 septembre 2019

using list values in an if statement to compare with a string

I have this list and string

list_var=(['4 3/4','6','6 3/4'])
string_var='there are 6 inches of cement inside'

i want to check through and find if any of the elements of the list is in the string

if list_var in strin_var (wont work of course due to the fact its a list but this is what i want to achieve is to compare all of the values and if any match return true)

i tried using any function but this not seem to work i would also like to achieve this without using loops as the code i will be using this in contains extracting data from a lot of files so execution speed is an issue

Aucun commentaire:

Enregistrer un commentaire