On 5/30/2009 10:58 PM Cameron Pulsford said...
Hello all, I'm trying to pretty print a list, so I am doing something like

print '%3d' % integer

only I would like that 3 to be a variable, instead of hardcoded. Is this possible, or are there any other ways to accomplish this? Thanks!


>>> integer = 12
>>> for lenvar in (4,5,6,7):
...     print ("%%%sd" % lenvar) % integer
...
  12
   12
    12
     12
>>>


Emile

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

Reply via email to