Chris Smith wrote:
high = [(1000,"Denise"), (945,"Denise"), (883,"Denise"),
(823,"Grant"), (779,"Aaron"), (702,"Pete"),
(555,"Tom"), (443,"Tom"), (442,"Robin"), (404,"Pete")]
for score, who in high:
col1 = str(score).rjust(10)
col2 = who.rjust(20).replace(' ', '.') #replace spaces with dots
print col1 + col2
###
--the output--
1000..............Denise
945..............Denise
883..............Denise
823...............Grant
779...............Aaron
702................Pete
555.................Tom
443.................Tom
442...............Robin
404................Pete
--end output--
Sweet. Note that in Python 2.4 you can write
col2 = who.rjust(20, '.')
instead of
col2 = who.rjust(20).replace(' ', '.') #replace spaces with dots
Kent
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor