from enum import Enum
from enum import IntEnum
class Suits(Enum):
DIAMONDS="diamonds"
HEARTS="hearts"
SPADES="spades"
CLUBS="clubs"
class Values(IntEnum):
TWO=2
THREE=3
FOUR=4
FIVE=5
SIX=6
SEVEN=7
EIGHT=8
NINE=9
TEN=10
JACK=11
QUEEN=12
KING=13
ACE=14
deck_of_cards=[]
class Playing_Cards():
def __init__(self, card_value, card_suit):
self.card_value=card_value
self.card_suit=card_suit
deck_of_cards=[]
for suit in Suits:
for value in Values:
deck_of_cards.append(Playing_Cards(value,suit))
print(deck_of_cards)
我想打印deck_of_cards
并显示对象列表。你能解释一下原因吗?
[<__main__.Playing_Cards object at 0x102268128>,
<__main__.Playing_Cards object at 0x102268198>,
<__main__.Playing_Cards object at 0x1022681d0>, <__main__.Playing_"
问题:
cards(value, suit)
添加到列表中?print
列表中的内容deck_of_cards
?