import string class Card:
# Not sure if I need to set these first??? # suitList = () # rankList = () def __init__(self,suit,rank): self.suit = suit self.rank = rank def __repr__(self): return str(self) def __str__(self): return "%s of %s" % (self.rankList[self.rank],self.suitList[self.suit]) def __cmp__(self,other): if self.suit > other.suit: return 1 if self.suit < other.suit: return -1 if self.rank > other.rank: return 1 if self.rank < other.rank: return -1 else: return 0 def getCard(cards): # Break each card into suit and rank rankList , suitList = string.split(cards," ") return Card(rankList,suitList) class Deck: def __init__(self): self.cards = [] for suit in range(4): for rank in range(1,14): self.cards.append(Card(suit,rank)) def main(): # Open the file with the cards in them filename = raw_input('Enter the file name for the cards >>') infile = open(filename,'r') # Set the first card in the list cards = getCard(infile.readline()) # Process the extra lines for line in infile: s = getCard(line) infile.close() a=Deck() print a main() -- http://mail.python.org/mailman/listinfo/python-list