On 04/21/12 14:44, Roy Smith wrote:
        ***********************
        *                     *
        * First Name and Last *
        * ENGR 109-X          *
        * Fall 2999           *
        * Format Example      *
        *                     *
        ***********************

You can take advantage of python's string formatting capabilities (which
are pretty much the same as C's printf() formatting), and do something
like:

print  "* %-*s *" % (max_length, data)

Sounds like a lot more work and less flexible than using the (underemployed) .ljust() or .center() methods of a string. :-)

  print "* %s *" % data.ljust(42)

-tkc



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

Reply via email to