Skip to content

Check if a strings starts or end with a specified value

Python has some nice methods to check if your strings start or end with a specified string, with str.startswith() and str.endswith(). They return a boolean whether the strings starts/ends with the specified value:

[sc name=”src” url=”https://stackoverflow.com/questions/8802860/checking-whether-a-string-starts-with-xxxx” ]

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.