[Tutor] Iterate Suggestion

Tom Tucker tktucker at gmail.com
Sat Apr 14 17:27:21 CEST 2012


Hello all.  Any suggestions how I could easily iterate over a list and
print the output 3 across (when possible)?  One method I was considering
was removing the recently printed item from the list, checking list length,
etc.  Based on the remaining length of the list I would then print X
across. Yah? Is their and easier approach I might be overlooking?


For example...

mylist = ['serverA', 'serverB', 'serverC', 'serverD',' serverE', 'serverF',
'serverG']


Desired Output
============
serverA  serverB  serverC
serverD  serverE  serverF
serverG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120414/03c3b5be/attachment.html>


More information about the Tutor mailing list