In order to test the beginning and ending of a given string in Python, one can use the methods str.startswith() and str.endswith().
str.startswith(prefix[, start[, end]])
As it's name implies, str.startswith is used to test whether a given string starts with the given characters in prefix.
>...