Re: formatting strings to have the same width

2007-03-17 Thread John Machin
On Mar 18, 10:17 am, "spohle" <[EMAIL PROTECTED]> wrote: > sorry the code should read: > > foo = ["aaa", "1232"] > for each in foo: > print each.center(10, " ") + " | " Works OK for me on the console: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win 32 Type "he

Re: formatting strings to have the same width

2007-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2007 16:07:44 -0700, spohle wrote: > hi, > > i got random strings and wanna attach a " | " at the end. now if i > print them i want the | to always be underneath each other. example > code: > > foo = ["aaa", "1232"] > for each in foo: > > print foo[0].center(10, " ") + " | " > f

Re: formatting strings to have the same width

2007-03-17 Thread spohle
sorry the code should read: foo = ["aaa", "1232"] for each in foo: print each.center(10, " ") + " | " -- http://mail.python.org/mailman/listinfo/python-list