How to achieve Python string contains effect

Category Quantity: python basis>  basic data types


Author: drifting

Original link:  http://www.pythonheidong.com/blog/article/34/

Source: python black hole net  www.pythonheidong.com

 

If you are looking for a similar js in Python or string.indexof method of string.contains

Metaphor you want to do the following:

 

if not somestring.contains("blah"):
   continue
In practice this effect can be achieved by In in python:

 

 

if "blah" not in somestring: 
    continue

 




 

Guess you like

Origin www.cnblogs.com/fuchen9527/p/10966823.html