0

Hi,

I have the following code:

import string
def main():
rank=[]
suit=[]
fname=string.split(open('H:\card.txt').read())

for line in fname:
rank.append(line)
print rank

The file (card.txt) is:

2 h
3 h
...

How's the easiest was to get the 2 into rank and the h equal hearts

Ultimately i need it to print:

2 of Hearts
3 of Hearts
...

Also it the numbers are not sorted, I would need to sort first.

Rgds
macca1111

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Ene Uran
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.