ok i m making a game poker card evaluator and i am storing its values in list of list and each list is containing the values like the [rate,rank,max] or just [1,2,3] so my question is if i want to know which players has good han开发者_StackOverflow社区d mean good list for example by comapring list to list, if rate1==rate2(list2 in the list of lists) then i have to check is their rank are also same if that condition also true then i have to go to next value in the same list and check with the other list having same first two values. if both lists are equal then we say they are equal else we find the greater one(rate,rank or max)
and this is for infinite list where i dont know what is the length of the list and its charcters
i hope you understand it know
Sequences are already compared element-wise; there is nothing you need to do in order to invoke the desired behavior.
Perhaps you mean something like this
>>> from operator import itemgetter
>>> L = [[1,2],[1,2],[1,4]]
>>> max(L, key=itemgetter(1))
[1, 4]
精彩评论