Arshad Mehmood

Search the blog

    Today I Learned

    String starts with a list of strings

    python

    str.startswith allows you to pass a tuple of strings to check if the string starts with any of them.

    if mystr.startswith((']', ')', '}')):
        return False