Checking String Start and End: startswith(), endswith() in Python


Check how a string starts or ends.

Source Code

filename = "example.txt"
print(filename.endswith(".txt"))
print(filename.startswith("ex"))
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments