📜  python 索引 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:45.102000             🧑  作者: Mango

代码示例3
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'))