t389.py 296 B

123456789101112131415
  1. s = "abcdabab"
  2. print s.find("ab")
  3. print s.find("ab", 5)
  4. print s.index("ab")
  5. print s.index("ab", 5)
  6. print s.find("ac")
  7. print s.find("ac", 5)
  8. print s.rfind("cd")
  9. print s.rfind("cd", 5)
  10. print s.rindex("ab")
  11. print s.rindex("ab", 5)
  12. print s.rfind("ac")
  13. print s.rfind("ac", 5)
  14. print s.rindex("ac", 5)