[1, 2] in [1, 2, 3] returns 0?

Sean 'Shaleh' Perry shalehperry at home.com
Sat Aug 25 14:48:44 EDT 2001


>>> lst = [[1,2], [2,3]]
>>> lst
[[1, 2], [2, 3]]
>>> sub = [1,2]
>>> sub in lst
1

sub is a list itself.  So you asked if lst contains the list sub, which it does
not.




More information about the Python-list mailing list