how to get output to the same line by overwriting previous received Timing(countdown) by NTP server. As shown below after each second timing is receiving in next row.
<
I am using python 2.7
python --version
Python 2.7.12 :: Anaconda 4.1.1 (64-bit)
and I am using this the following function as a hook to display the download progress, by using urllib.urlretrieve
def hook(bcount , bsize, tsize ):
str = "[ %3d%% of %10d] \r" % (bcount * bsize * 100/tsize , tsize)
print str,
urllib.urlretrieve (url, file_name, hook)
Explanation: the \r put the cursor at start of the line , and the comma avoid to print in a new line , if you have the same number of character for each print , this will do the trick
if you are curious about urllib and the hook I am using you'll find the doc https://docs.python.org/2/library/urllib.html