On Dec 2, 5:31 am, Aaron Scott <[EMAIL PROTECTED]> wrote: > I was using .index on the > list, but it would return True for strings that contained the search > string rather than match it exactly, leading to false positives in my > code.
Are you sure? That doesn't seem like standard behaviour. >>> l = ["one", "two", "three", "four"] >>> l.index('on') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: list.index(x): x not in list >>> l.index('thre') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: list.index(x): x not in list The only time I'd expect it to do partial matches is if you were doing string.index(string), rather than list.index(string): >>> "four".index('our') 1 -- http://mail.python.org/mailman/listinfo/python-list