On Sun, Sep 2, 2012 at 10:23 AM, gwhite <gwh...@ti.com> wrote: > I can't figure out how to stop the "add a space at the beginning" > behavior of the print function. > >>>> print 1,;print 2, > 1 2 > > See the space in between the 1 and the 2 at the output print to the > command console? > > The help for print is: > > "A space is written before each object is (converted and) written, > unless the output system believes it is positioned at the beginning of > a line." > > So it is apparently doing what it is supposed to do. > > Is there a way to stop this?
If you were to use Python 3.x, yes. Otherwise, no. > Or is there a different function that > will only print what you have in the formatted string? Use the .write() method of the sys.stdout file object. http://docs.python.org/library/sys.html#sys.stdout Alternatively, you can stick with `print` and rework your code so that it outputs an entire line at a time (thus, there'd only be 1 argument passed to `print`, so its "spaces between arguments" feature wouldn't come into play). Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list