On Sep 2, 1:37 pm, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: > On Sun, 2 Sep 2012 10:23:53 -0700 (PDT), gwhite <gwh...@ti.com> > declaimed the following in gmane.comp.python.general: > > > > > "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? Or is there a different function that > > will only print what you have in the formatted string? > > E:\UserData\Wulfraed\My Documents>python > ActivePython 2.7.2.5 (ActiveState Software Inc.) based on > Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit > (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > > >>> import sys > >>> print "1",;sys.stdout.softspace=0;print "2" > 12 > > >>> sys.stdout.write("1");sys.stdout.write("2");print > 12 > > In Python 2.x, the equivalent of fprint/fprintf is NOT print but > sys.stdout.write/file_object.write > > "print" is just a convenience function that is designed to translate > its arguments into a textual representation, and then drop it to the > screen. Part of the convenience is to separate output items by a space > and to emit a newline at the end. > > .write(), OTOH, does no formatting -- not even new lines. You have > to provide all conversion to text, and line endings.
Thanks. I am starting to get it. -- http://mail.python.org/mailman/listinfo/python-list