How to get the highest index of a character inside a string with Python

1 Answer

0 votes
string = 'php python java c python c++ python'
character = 'p'
 
index = string.rindex(character)

print(index)
 
 
 
 
'''
run:
 
29
 
'''

 



answered Dec 10, 2019 by avibootz
edited Feb 8, 2021 by avibootz

Related questions

...