Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

What is the index in python

1) how to find index of a word in a string:
  my_string = "Hello World!"

  my_string.index("l")

2) how to find the first occurance of a word in a string:
  print(verse.index('and'))
  
  
 3)how to find the last occurance of a word in a string:
  print(verse.rindex('you'))
 
PREVIOUS NEXT
Tagged: #What #index #python
ADD COMMENT
Topic
Name
2+2 =