Searching from end of string : String rindex : String PYTHON examples


PYTHON examples » String » String rindex »

 

Searching from end of string


Searching from end of string


string1 = "Test1, test2, test3, test4, Test5, test6"


print 'Index from end of "test" in "%s" is %d
   string1, string1.rfind"test" ) )
print

# find rindex of "Test"
try:
   print 'First occurrence of "Test" from end at index', 
      string1.rindex"Test" )
except ValueError:
   print '"Test" does not occur in "%s"' % string1

print

           
       



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo String
» String rindex