Python - Why do the find and index methods work differently?
问题 In Python, find and index are very similar methods, used to look up values in a sequence type. find is used for strings, while index is for lists and tuples. They both return the lowest index (the index furthest to the left) that the supplied argument is found. For example, both of the following would return 1 : "abc".find("b") [1,2,3].index(2) However, one thing I'm somewhat confused about is that, even though the two methods are very similar, and fill nearly the same role, just for