y = any(x in String for x in List)
if any(ext in url_string for ext in extensionsToCheck):
print(url_string)
string = "hello"
list = ["bye", "kasd", "hello", "day", "hel"]
if string in list:
print(f"Found '{string}' in '{list}'!")
else:
print(f"Couldnt find '{string}' in '{list}'!")
>>> Found 'hello' in '["bye", "kasd", "hello", "day", "hel"]'!
#This is the list. You can place it in other file and import it.
"In the same file:"
MyList = ["something", "something2", "something3"]
IncredibleWord = "something"
if IncredibleWord in MyList:
print("Yes, IncredibleWord is in your list")
else:
print("No, IncredibleWord isn't in your list")
#------------------------------------------------------------------------------
"If your list is in an other file:"
#OtherFile
MyList = ["something", "something2", "something3"]
#MyMainFile
#Variables and lists for example
from OtherFile import *
IncredibleWord = "something"
if IncredibleWord in MyList:
print("Yes, IncredibleWord is in your list")
else:
print("No, IncredibleWord isn't in your list")
#-------------------------------------------------------------------------------
#Only a variable or a list for example
from OtherFile import <List Name>
IncredibleWord = "something"
if IncredibleWord in MyList:
print("Yes, IncredibleWord is in your list")
else:
print("No, IncredibleWord isn't in your list")
isinstance(some_object, str)
x = "a"
xlist = ["a", ]
if x in xlist:
print(x)
# Gives True/False if a string is in a list.
input = 'hello'
result = input in ['greetings', 'and', 'hello', 'sir']
print(result)