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

2 Answers

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

if s.endswith("c#"):
    print("yes")


'''
run:

yes

'''

 



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

if not s.endswith("?"):
    print("yes")


'''
run:

yes

'''

 



answered Nov 10, 2018 by avibootz
...