How to check if string start or not start with substring in Python

2 Answers

0 votes
s = "python php java c c++ c#"

if s.startswith("python"):
    print("yes")


'''
run:

yes

'''

 



answered Nov 10, 2018 by avibootz
0 votes
s = "python php java c c++ c#"

if not s.startswith("java"):
    print("yes")


'''
run:

yes

'''

 



answered Nov 10, 2018 by avibootz
...