Hans Dushanthakumar wrote: > print outputs the string to the std output (sys.stdout). You could > redirect the std output to a file instead of the screen as follows, but > it's a bit clumsy. > > TCL provides a more handy way of doing this: > print $fptr "Hi there"
In Python you can say print >>fptr, "Hi there" Kent > > Cheers > Hans > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Dick Moores > Sent: Thursday, 6 October 2005 12:18 p.m. > To: tutor@python.org > Subject: [Tutor] How to write this to a file? > > I have a script that writes it's output to a file. I also print the time > with > > print "Time was %.4g seconds" % (timeEnd - timeStart) > > How could I also have the same output of the print expression, written > to the file? > > Thanks, > > Dick Moores > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor