print "foo", without a space

Charles G Waldman cgw at fnal.gov
Thu Nov 11 10:11:30 EST 1999


Michael Hudson writes:
 > Mikael Johansson <mikael.johansson at helsinki.xx> writes:
 > 
 > > Hello All!
 > > 
 > > Is there another way of getting print to not make a newline than
 > > using:
 > >     print "foo",  ?
 > 
 > I think there's some way invloling sys.stdout.softspace, but I'm no
 > sure what. However...

Another option is to forego the "print" and use "sys.stdout.write()"
instead.  Conversion of the argument to a string is your
responsibility, and no extra spaces/newlines/etc are added to the
output.





More information about the Python-list mailing list