startswith() with any() example
my_string = "Hello Python"
# Prefixes (List)
prefixes = ["Javascript", "Php", "Hello"]
# Checking if starts with
c = any(my_string.startswith(p) for p in prefixes)
# Print Output
print(c)
Output:
True
my_string = "Hello Python"
# Prefixes (List)
prefixes = ["Javascript", "Php", "Hello"]
# Checking if starts with
c = any(my_string.startswith(p) for p in prefixes)
# Print Output
print(c)
Output:
True