Print function and spaces

wes weston wweston at att.net
Thu Feb 5 10:17:56 EST 2004



Dan Williams wrote:
> Hi people
> 
> I'm getting a little annoyed with the way the print function always adds a
> space character between print statements unless there has been a new line.
> The manual mentions that "In some cases it may be functional to write an
> empty string to standard output for this reason." Am I the only the who
> thinks that this sucks? It's the first thing I've come across in Python that
> I really think is a design flaw.
> 
> Is there a good way to stop the space being automatically generated, or am I
> going to have to write a blank string to standard output, like the manual
> mentions?
> 
> Cheers
> 
> Dan
> 
> 
> 
> 
Dan,
    'Does seem a little odd. There's often a good reason
for python "oddities". Usually, it's a matter of practicality.
Maybe it was thought that most intended uses of print are
better of with a space.

 >>> a="a"
 >>> b="b"
 >>> print "%s%s" % (a,b)
ab
 >>>




More information about the Python-list mailing list