[Tutor] Writing over a line in a text file

kieran flanagan kieran.flanagan at gmail.com
Wed Jun 21 13:33:14 CEST 2006


Hi

I have a question regarding writing text to a file. I am directing output to
a logfile. During one of the loops, I have a command that will issue a
message on how long it is waiting for by doing something like this

while something:

                print "\rNow waiting %s seconds .. " % seconds,
                sys.stdout.flush()
                print "\r                   ",

I am trying to change my scripts so all info can be accessed via logfiles.
Is there any way I can direct the output to a logfile, as above, without
creating a new line for each print statement. I have tried changing the
sys.stdout to the logfile in question but the print commands just force a
new line for each print statement.

Any ideas would be welcome.

Cheers
Kieran


-- 
"Behind every great man, there is a great woman. Behind that woman is Mr.T."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060621/69081006/attachment.html 


More information about the Tutor mailing list