Q: Print whithout \n

Dave Brueck dbrueck at edgix.com
Tue Dec 12 09:29:59 EST 2000


> As others have said, print with a , works, but it gives you a space
> instead.  If this disturbs you as it does me, you can use the
> write method

You can also set sys.stdout.softspace to 0, but that's annoying if you have
to do it more than once or twice:

>>> def msg(s):
... 	print 'Msg is:',
... 	sys.stdout.softspace = 0
... 	print s
...
>>> msg('Blah')
Msg is:Blah

-Dave





More information about the Python-list mailing list