What is the fastest way to know if a value exists in a list (a list with millions of values in it) and what its index is?
I know that all values in the list are uniqu
Or use __contains__:
__contains__
sequence.__contains__(value)
Demo:
>>> l=[1,2,3] >>> l.__contains__(3) True >>>