En Wed, 01 Oct 2008 04:51:33 -0300, sc <[EMAIL PROTECTED]> escribió:

Thanx to a recent thread I am able to have a print string
with a variable number of formatters -- what I now lack for
the creation of an elegant print statement is a tuple --
following is the code, the last line of which does not work:

for i in range(1, len(h.m)):
    k = "r%06d" % i
    col = len(h.m[k])
    if col > 2 and h.m[k][0] > " ":
        print (col * '%-30s') % h.m[k]
</code>

Another alternative would be:

print ''.join('%-30s' % item for item in h.m[k])

You may need to add square brackets [ ] inside the parenthesis () if your Python version is older than 2.5

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to