How to find the last occurrence of character in string with Python

1 Answer

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

pos = s.rfind("c")
print(pos)

print(s[:pos])

'''
run:

13
python c++ c 

'''

 



answered Feb 25, 2017 by avibootz
...