Skip to content

Supply a list of strings to str.startswith()

Often you not only want to check if a string starts with one string, but with many. If you supply a tuple, that’s actually possible.

text.startswith(("foo", "bar", "apple", "banana"))


Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.