Home > Backend Development > Python Tutorial > Python implementation confirms whether a string contains an instance of the specified string

Python implementation confirms whether a string contains an instance of the specified string

不言
Release: 2018-05-02 14:02:57
Original
2191 people have browsed it

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template