Print always puts newline (or adds a space)

Tobias Pfeiffer BoteDesSchattens at web.de
Tue Sep 16 16:40:47 CEST 2003


Hi!

Erik Max Francis <max at alcyone.com> wrote in news:3F64DEF7.F98CFAB8
@alcyone.com:

>> Is there a "lower level" way to output
>> chars other than 'print'?
> 
> Yep, call sys.stdout.write directly.

Is it then also possible to "jump back" a few chars to, e.g., have a 
progress... (damn, I forgot that word) however, that shows the percentage 
of progress? Like print "25%" and then jump back three chars and write 
"26%"?
And then, on my Linux machine, such things just don't happen at all. E.g. 
in a loop like...

for i in range(1000):
    	j = pow(2,i)
    	if j%100: print "#",

...I will get nothing for a long time and then ten "#" chars at one time. 
Is there a solution for that?

Bye
Tobias




More information about the Python-list mailing list