[Tutor] Two More Questions

alan.gauld@bt.com alan.gauld@bt.com
Wed, 28 Feb 2001 17:20:26 -0000

> >>> string.center('''hello world.
> ... this is a test.''', 45)
> '         hello world.\012this is a test.        '
> ###
> Hmmm... but it depends on the function if it handles a 
> multi-line string properly or not.  string.center() 
> certainly didn't handle that nicely.  

Why not? It preserved the \012 nicely. if you had 'print'ed 
the output then it would have been laid out as you requested:

            hello world
this is a test

Now whether thats what you expected centre to dso is another 
matter, it certainly won't centre each line, but it doesn't 
claim to do so.

Alan g.