Using Python 3.4, is there an agnostic printing mechanism between the last and second to last lines? What I'm trying to execute is basically a progress bar always on the last line. The second line and up are debug logs only. For instance:
[DEBUG] Some info...
[DEBUG] More info...
Download Progress: [#### ] 40% (3 of 20)
I run some downloads in a loop. Each iteration of the loop I run to print the execution line:
def _print_progress_bar(self):
amt_done = self._count / self._max
print('\rDownload Progress: [{:20s}] {:.1f}% ({})'.format(
'#' * int(amt_done * 20),
amt_done * 100,
self._padded_counter(' of ')), end='')
Between calls to this method, in order to display a progress bar, I want to insert diagnostic messages into it (I do not want instructions to printoverwrite the progress bar basically after that).
How can i do this?
source
share