• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in Python by
Q:
Does Python have a string 'contains' substring method?

Can someone help to get string.contains or string.indexof method in Python.

I want to do:

if not somestring.contains("blah"):

   continue

1 Answer

0 votes
by
You can use the in operator:

if "blah" not in somestring:

    continue

Related questions

0 votes
asked Dec 14, 2019 in Python by sharadyadav1986
+1 vote
asked Feb 13 in Python by SakshiSharma
...