Use cmp() to compare lists : Compare List « List « Python Tutorial






list1, list2 = [123, 'xyz'], [456, 'abc']
print cmp(list1, list2)
print cmp(list2, list1)
print list3 = list2 + [789]
print list3
print cmp(list2, list3)








7.4.Compare List
7.4.1.Compare the nested list objects
7.4.2.Compare two lists
7.4.3.Use cmp() to compare lists