The Scoop on Python Input?

Chris Barker chrishbarker at home.net
Tue Jun 19 12:35:23 EDT 2001


Rainy wrote:
> 
> Also, there doesn't seem to be any
> way to unget the character, i.e. make a progress indicator that shows
> 37% 42% etc but in one place as something progresses, except in curses.

Yes, there is. But it's also not pretty:
import sys,time

for i in range(100):
    sys.stdout.write("  %i%%    \r"%i)
    sys.stdout.flush()
    time.sleep(.05)
sys.stdout.write("\n")




-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list