Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
Does Python have a string 'contains' substring method?
Home
Python
Does Python have a string 'contains' substring method?
+1
vote
asked
Jan 10, 2021
in
Python
by
rajeshsharma
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
#python-string
string
python
substring
contains
Python-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jan 10, 2021
by
rajeshsharma
You can use the in operator:
if "blah" not in somestring:
continue
Your comment on this answer:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Related questions
0
votes
Q: In Python how do you convert a string into lowercase?
asked
Feb 11, 2021
in
Python
by
SakshiSharma
#python-string
string
string-lowercase
python-lowercase
Python-questions-answers
0
votes
Q: How can you capitalize the first letter of a string?
asked
Feb 11, 2021
in
Python
by
SakshiSharma
#python-string
string-function
python
python-captitalize-string
Python-questions-answers
+1
vote
Q: TypeError: a bytes-like object is required, not 'str' when writing to a file in Python3
asked
Jan 10, 2021
in
Python
by
rajeshsharma
python
python-3
x
string
file
byte
Python-questions-answers
+1
vote
Q: Given a string, return the first recurring character in it, or “None” if there is no recurring character.
asked
Oct 28, 2022
in
Python
by
SakshiSharma
python
string
functions
0
votes
Q: Which of the following function convert a string to a float in python?
asked
Feb 11, 2020
in
Python
by
rahuljain1
#python-string
Python-questions-answers
0
votes
Q: What Is A String In Python?
asked
Dec 14, 2019
in
Python
by
sharadyadav1986
#python-string
Python-questions-answers
0
votes
Q: Python error: string index out of range python
asked
Nov 15, 2020
in
Python
by
rajeshsharma
#python-error
#python-string
#python-string-index
#string-index
Python-questions-answers
0
votes
Q: What is Python String format and Python String replace?
asked
May 17, 2020
in
Python
by
SakshiSharma
#python-string
#string-python
Python-questions-answers
0
votes
Q: Define String in Python?
asked
May 16, 2020
in
Python
by
Robindeniel
#python-string
#string-python
Python-questions-answers
0
votes
Q: What does the match method of re module do?
asked
Jan 11, 2021
in
Python
by
SakshiSharma
#python-re-module
#python-module
#python-string
Python-questions-answers
...