Home  >  Article  >  Backend Development  >  Is there a way to check string inclusion in Python?

Is there a way to check string inclusion in Python?

silencement
silencementOriginal
2019-05-23 11:42:194981browse

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.

Is there a way to check string inclusion in Python?

Several ways to determine whether a string contains a substring in Python

1 , use the member operator in

Is there a way to check string inclusion in Python?

2. Use the find()/rfind() method of the string module

Is there a way to check string inclusion in Python?

3. Use the index()/rindex() method of the string module

Is there a way to check string inclusion in Python?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn