Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to flush print

Reply
Thread Tools

How to flush print

 
 
Jay Davis
Guest
Posts: n/a
 
      03-06-2004
If you open a file the usual way, you can flush
the output buffer with .flush(). How do you flush
the output buffer of a print command, either
'print string' or 'print >>ofile, string' ?
 
Reply With Quote
 
 
 
 
Gerrit
Guest
Posts: n/a
 
      03-07-2004
Jay Davis wrote:
> If you open a file the usual way, you can flush
> the output buffer with .flush(). How do you flush
> the output buffer of a print command, either
> 'print string' or 'print >>ofile, string' ?


print string

is really short for

sys.stdout.write("%s" % string)

so you can flush it with

sys.stdout.flush()

Gerrit.
--
Weather in Amsterdam Airport Schiphol, Netherlands 07/03 08:55 UTC:
6.0°C Few clouds partly cloudy wind 3.1 m/s W (-2 m above NAP)
--
Asperger's Syndrome - a personal approach:
http://people.nl.linux.org/~gerrit/english/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
print a vs print '%s' % a vs print '%f' a David Cournapeau Python 0 12-30-2008 03:19 AM
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM
can't flush print when download open-uri T. Onoma Ruby 1 11-12-2003 11:00 AM



Advertisments