Answers for "python check if string contains only one character"

2

how to check if all characters in string are same python

s == len(s) * s[0]
Posted by: Guest on May-14-2020
4

python check if string contains substring

string = "My favourite programming language is Python"
substring = "Python"

if substring in string:
    print("Python is my favorite language")
elif substring not in string:
    print("Python is not my favourite language")
Posted by: Guest on January-17-2021

Code answers related to "python check if string contains only one character"

Python Answers by Framework

Browse Popular Code Answers by Language