Beginning programmer question - How to print a list in a different format
John
John at the.computer
Fri Feb 6 21:40:33 EST 2004
Hi.
I have a dictionary thus: (wraps)
p1hand =
{'b12':b12,'d12':d12,'d23':d23,'n12':n12,'n23':n23,'n34':n34,'p12':p12,'
p23':p23,'p34':p34,'p45':p45}
I set a variable called p1handlist so that I can print a list of the
keys to the screen:
p1handlist = p1hand.keys()
print p1handlist
and the output looks like this:
['b12', 'd12', 'd23', 'n12', 'n23', 'n34', 'p12', 'p23', 'p34', 'p45']
how can I make it so that the output looks more like this?:
b12, d12, d23, n12, n23, n34, p12, p23, p34, p45
This is for a simple text mode game I am writing and the output to the
screen is important because at times the list gets too big to print on
one line of the display.
Thanks!
John
More information about the Python-list
mailing list