Home > Article > Backend Development > Python implementation confirms whether a string contains an instance of the specified string
This article mainly introduces the example of Python implementation to confirm whether a string contains a specified string. It has a certain reference value. Now I share it with you. Friends in need can refer to it
Sometimes we We need to search in a certain string or a certain statement to confirm whether it contains the string information we need.
For example,
The segment variable is: A= ”My name is Clay, and you can get my name”
A = "My name is Clay, and you can get my name“ myName = "Clay" if myName in A: //do what you want to do
And we need to find whether A contains Clay field.
Related recommendations:
Python examples of adding variables to strings
Python finds characters in strings Location instance
The above is the detailed content of Python implementation confirms whether a string contains an instance of the specified string. For more information, please follow other related articles on the PHP Chinese website!