Re: [Python-ideas] 回复: Columnize in module "cmd"

2011-12-20 Thread MRAB
On 21/12/2011 03:28, Tom Zhou wrote: Thanks a lot for your reply! I've reservations, maybe code looks like: """ colwidth = max(map(len, list)) ncols = displaywidth/(colwidth+2)+1 nrows = size/ncols+1 for nrows for ncols texts = list[...] output texts """ is clear, and jus

Re: 回复: Columnize in module "cmd"

2011-12-20 Thread Peter Otten
Tom Zhou wrote: > Thanks for your reply! But i think using "for@for@for" to find out the > appropriate column size is also another waste, on the other hand, the > length of the list's single string is similar with each other usually, so > the maximum maybe is the mode of the list. There are usual

回复: Columnize in module "cmd"

2011-12-19 Thread Tom Zhou
___ 发件人: Ian Kelly 收件人: Tom Zhou 抄送: "python-list@python.org" 发送日期: 2011年12月19日, 星期一, 下午 7:35 主题: Re: Columnize in module "cmd" On Mon, Dec 19, 2011 at 7:53 PM, Tom Zhou wrote: > Hi~ alls > recently, i focus on the module "cmd", and find some conf

Re: Columnize in module "cmd"

2011-12-19 Thread Ian Kelly
On Mon, Dec 19, 2011 at 7:53 PM, Tom Zhou wrote: > Hi~ alls > recently, i focus on the module "cmd", and find some confused things-- the > function named "columnize". Why we need a multiloop as > "for nrows .. > for col .. >for row.." > ?? i think we can make a easier m

Columnize in module "cmd"

2011-12-19 Thread Tom Zhou
Hi~ alls recently, i focus on the module "cmd", and find some confused things-- the function named "columnize". Why we need a multiloop as "for nrows ..         for col ..                    for row.." ?? i think we can make a easier method, for example, first, find out the maxlen str in list, an