from random import shuffle, choice
def deal_cards():
colors = ['♥', '♠', '♣', '♦']
nums = [str(x) for x in range(2, 11)] + ['J', 'Q', 'K', 'A']
pokers = []
for n in nums:
for c in colors:
pokers.append(c+n)
pokers.extend(('JOKER', 'joker'))
landlord = choice(pokers)
pokers.remove(landlord)
landlord = '地' + landlord
pokers.append(landlord)
shuffle(pokers)
player1 = []
player2 = []
player3 = []
d_pokers = iter(pokers)
for _ in range(17):
player1.append(next(d_pokers))
player2.append(next(d_pokers))
player3.append(next(d_pokers))
table = {str(x): x for x in range(3, 11)}
table.update({'J': 11, 'Q': 12, 'K': 13, 'A': 14, '2': 15, 'oker': 16, 'OKER': 17})
player1.sort(key=lambda item: table[item[2:]] if item.startswith('地') else table[item[1:]], reverse=True)
player2.sort(key=lambda item: table[item[2:]] if item.startswith('地') else table[item[1:]], reverse=True)
player3.sort(key=lambda item: table[item[2:]] if item.startswith('地') else table[item[1:]], reverse=True)
return player1, player2, player3, list(d_pokers)
p1, p2, p3, d = deal_cards()
print(p1)
print(p2)
print(p3)
print(d)