Using print with format to stdout generates unwanted space

Jorgen Grahn jgrahn-nntq at algonet.se
Tue Jun 21 07:21:39 EDT 2005


On Tue, 21 Jun 2005 00:08:03 +0100, Tim Williams (gmail) <tdwdotnet at gmail.com> wrote:
...
> For quick and simple removal of the extra space,  append a '\b'
> backspace character to your output "string"

For things that are only ever to be viewed on the terminal, yes.
But this does, of course, print an actual backspace character.
If you feed this output to another program, chances are it will
not treat <space><backspace> as no space at all.

I prefer building up a list and doing ' '.join(thelist) in these situations.

/Jorgen

-- 
  // Jorgen Grahn <jgrahn@       Ph'nglui mglw'nafh Cthulhu
\X/                algonet.se>   R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list