[Tutor] Need to be taught a trick or two about printing in neat columns

Dick Moores rdm at rcblue.com
Thu Nov 2 21:26:38 CET 2006


At 11:51 AM 11/2/2006, Kent Johnson wrote:
>Dick Moores wrote:
>>Oops! Got overconfident. Didn't check to see if it actually printed 
>>the whole list. It didn't. Left off "rad: radian", because there 
>>are 46 items in the list (46%3 is 1, not 0). So now the only way I 
>>could see to print all 46 was to add 2 empty dummies to make 48, 
>>which is divisible by 3, and also modify the range in the second 
>>function. Is there a better way, which is also a general solution 
>>that will work when I subtract or add to the list? See the 
>>two  modified functions below.
>
>There are almost enough grouping recipes in the cookbook to give 
>them their own category. They tend to be fairly obscure. There is 
>one in the comment on this page that would work for you:
>http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496958

Thanks for digging that out, Kent. If you think that one in the 
comment is obscure, imagine how it looks to me. It'll take a lot of 
study. I may ask some questions..

Dick



More information about the Tutor mailing list