特牛生活网

Python简单实现一副扑克牌_import collections card = collections.namedtuple('-CSDN博客

网友收藏
Python实现数据模型一副扑克牌一、首先我们写类import collectionsCard = collections.namedtuple('Card',['rank','suit'])class FrenchDeck: ranks = [str(n) for n in range(2,11)] + list('JQKA') suits = 'spades diamonds clubs hearts'.split() def __init__(self): self._cards =_import collections card = collections.namedtuple('card',['rank','suit']) cla