#coding = utf-8 import random def Creat_Card(): card_type = ['♥','♠','♦','♣'] card_values= ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K'] n=1 cards = ['大J','小J'] for i in card_type: for j in card_values: cards.append((i+j)) n += 1 print('牌库生成中.............') print(cards.__len__()) return cards def WashAndPush_Card(cards): print('洗牌中.............') wash_card = random.shuffle(cards) #shuffle可以直接将排序打乱 print('发牌中') print('底 牌 : %s' %cards[0:3]) player1 = cards[3:20] player2 = cards[20:37] player3 = cards[37:54] print ('player1 : '+ str(player1)) print ('player2 : '+ str(player2)) print ('player3 : '+ str(player3)) if __name__ == '__main__': WashAndPush_Card(Creat_Card())