values = '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A'
suits = 'H', 'C', 'D', 'S'
sRep = {'H': 'Hearts', 'C': 'Clubs', 'D': 'Diamonds', 'S': 'Spades'}
ranks = {'2': 15, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9,
    '0': 10, '0': 10, 'J': 11, 'Q': 12, 'K': 13, 'A': 14}


class Card:

    def __init__(self, value, suit):
        value = str(value)
self.value, self.suit = value.upper(), suit.upper()
self.rSuit = sRep[suit.upper()]
self.rank = ranks[value.upper()]

def __repr__(self):
    return '%s of %s' % (self.value, self.rSuit)

def __cmp__(self, other):
    if self.rank > other.rank:
        return 1
if self.rank < other.rank:
    return -1
if self.value > other.value:
    return 1
if self.value < other.value:
    return -1
if self.rSuit > other.rSuit:
    return 1
if self.rSuit < other.rSuit:
    return -1
return 0
Sorting a list of lists by length and by value