0

I am trying to make a progress bar, but I don't want it to print a new line for each character that represents the bar (like: "#"). How do I update the line without printing it again?

3 Answers3

1

You can print a # without newline with:

print('#', end='', flush=True)
user4815162342
  • 141,790
  • 18
  • 296
  • 355
1

This is not direct answer to question but just potential suggestion. for many "pretty" terminal formatting i have found rich python package to be very useful. for example has progress bar: link see example of what looks like in gif under progress bar section of readme

kamster
  • 139
  • 6
0

You need to change the end of line character to nothing.

print("#", end =''', flush=True )