check if string element in list python code example

Example 1: if list item in string python

if any(ext in url_string for ext in extensionsToCheck):
    print(url_string)

Example 2: python check if string

type('hello world') == str
# output: True

type(10) == str
# output: False

Example 3: python check if value in string

def is_value_in_string(value: str, the_string: str):
    return value in the_string.lower()

Example 4: python find if element in list

element_you_want_to_find in list_in_you_want_to_search
Note: Don't forget to substitute both of that variables with the variables you want

  Conclusion: Use the in operator