python - there is a way to detect if '\r' work or not? -


i have script download files urllib.request.urlretrieve , use tqdm progress bar , work fine, except when use in idle because there others control characters '\r' or '\b' don't work , result output ugly

that

idle

>>> print('abc\rxxx') abc\rxxx >>> print('abc\b\b\bxxx') abc\b\b\bxxx >>> 

terminal/cmd

>>> print('abc\rxxx') xxx >>> print('abc\b\b\bxxx') xxx >>> 

my question is, how can detect when '\r' work properly??

so can this

from tqdm import tqdm, tqdm_gui if control_char_work_fine():     progress_bar = tqdm else:     progress_bar = tqdm_qui 

or if no possible how detect when in idle?


Comments