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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.