I need to print over one line in a loop (Python 3.x). Looking around on SO already, I put this line in my code:
print('{0} imported\r'.format(tot),)
However, it still prints multiple lines when looped through. I have also tried
sys.stdout.write('{0} imported\r'.format(tot))
but this doesn't print anything to the console...
Anyone know what's going on with this?
sys.stdout.write()
works for me .. you haveimport sys
. Are you trying to overlay the output on the same line?print text,
from python 2.x, you need to use theend
argument, as inprint(text, end='')
. The comma at the end of the function arguments has no effect.print(text, end='')
gives me a syntax error at the=
.