On 07/11/2018 16:22, Chip Wachob wrote: > What I would like to do is display, on a single line, in the terminal > / command line a progress percentage, or, simply a sequence of - / - > \, etc.. or even, accumulating period characters. > > What would the escape codes be, or is there a better way to handle this?
It depends on your Python version. In Python v2 you simply put a comma after your output character to turn off the auto newline while someProcess(): # should probably be in a separate thread... time.sleep(1) # 1 second pause print '.', # comma suppresses newline If you want to suppress the spaces tyoo things get a tad more complex and you are probably best writing direct to sys.stdout In Python 3 there are parameters to print() while someProcess(): time.sleep(1) print('.', end='', sep='') # no newline and no spaces You shouldn't need any special escape codes. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor