[Tutor] updating a print statement

Ole Henning Jensen tjampman at gmail.com
Mon Dec 10 19:37:59 CET 2007


Sry about the previous mail.

----- Original Message ----- 

I have a print statement in a for loop so I can watch the progress

for line in file(file):
    the_line = line.split()
    if the_line:
        print ("Index = %.2f") %index

Is there a way that only one line will be output and the variable is updated
rather than one line for every index.
-------------------------

Now I'm still only in the learning process, but couldn't you do something 
like this:

for line in file(file):
    the_line = line.split()
    if the_line:
        Index = "%.2f" %index     # This line might have to be
                                                # adjusted to do what it is 
you want
print "Index= " + Index


BR
Ole

PS heres to hoping the code is indented properbly. 




More information about the Tutor mailing list