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 just waste some space of stdout.
A couple of points: 1. Trying not to use the names of built-in classes or functions for your variable names, for example "list". 2. In Python 2 int/int returns an int, but in Python 3 int/int returns a float. In both cases int//int returns an int (at least for recent versions of Python 2), so it's a good idea to always use // when you want to do integer division. -- http://mail.python.org/mailman/listinfo/python-list