There is a method to check the inclusion of a string in Python. You can use: 1. Member operator in to check, the syntax is "string in character"; 2. The find() or rfind() method of the string module to check Check; 3. Check using the index() or rindex() method of the string module.
Several ways to determine whether a string contains a substring in Python
1 , use the member operator in
2. Use the find()/rfind() method of the string module
3. Use the index()/rindex() method of the string module
The above is the detailed content of Is there a way to check string inclusion in Python?. For more information, please follow other related articles on the PHP Chinese website!