4.5.3 Python, detect prefix or suffix

When processing a string, sometimes it is necessary to check whether the string starts with a certain prefix or ends with a certain suffix. At this time, you can use the startswith() and endswith() functions, as shown in the table.
Insert picture description here
Next, demonstrate the usage of these two functions, as shown in the example.
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43398418/article/details/110171484