[Tutor] updating a print statement
Kent Johnson
kent37 at tds.net
Mon Dec 10 23:45:26 CET 2007
This works for me:
import sys
import time
for i in range(5):
print '\rIndex =', i,
sys.stdout.flush()
time.sleep(1)
Kent
Bryan Fodness wrote:
> I ran it both in IDLE and Command Prompt
>
> On Dec 10, 2007 5:02 PM, Kent Johnson <kent37 at tds.net
> <mailto:kent37 at tds.net>> wrote:
>
> How are you running the program?
>
> Bryan Fodness wrote:
> >
> > for line in file('test.txt'):
> > the_line = line.split()
> > if the_line:
> > if the_line[0] == 'Index':
> > index = float(the_line[-1])
> > print ("\rIndex = %.3f ") %index,
> > raw_input("\nExit")
> > Here is my output,
> >
> > Index = 0.000 Index = 0.400 Index = 0.800 Index = 1.000
More information about the Tutor
mailing list