title: How to use \r to print on same line?
body: <p>I have made a downloader:</p>
  
  <pre><code>#!/usr/bin/env python
  #-*- coding:utf-8 -*-
  
  from __future__ import print_function, division, absolute_import, unicode_literals
  import os
  import argparse
  try:
      from urllib2 import urlopen
  except ImportError:
      from urllib.request import urlopen
  
  # {{ Argument parser
  parser = argparse.ArgumentParser(
      prog='downloader',
      description='a featureful downloader'
  )
  
  parser.add_argument(
      '-o',
      dest='outputfile'
  )
  
  parser.add_argument(
      '-r',
      dest='remotefile'
  )
  
  downloader = parser.parse_args()
  # }}
  
  # {{ default local filename
  if downloader.outputfile:
      default_output_file = downloader.outputfile
  else:
      default_output_file = os.path.split(downloader.remotefile)[-1]
  # }}
  
  u = urlopen(downloader.remotefile)
  meta = u.info()
  file_size  = int(dict(meta.items())['Content-Length'])
  print("Downloading: %s Bytes: %s" % (default_output_file, file_size))
  
  with open(default_output_file, 'wb') as f:
      file_size_dl = 0
      block_sz = 8192
      while True:
          buffer = u.read(block_sz)
          if not buffer:
              break
  
          file_size_dl += len(buffer)
          f.write(buffer)
          status = r"%10d  [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
          status = status + chr(8)*(len(status)+1)
          print(status)
  </code></pre>
  
  <p>A sample run of this script would be:</p>
  
  <pre><code>python3 downloader.py -o ubuntu.iso -r http://releases.ubuntu.com/13.04/ubuntu-13.04-desktop-i386.iso
  </code></pre>
  
  <p>And a sample output will be:</p>
  
  <pre><code>Downloading: ubuntu.iso Bytes: 832569344
        8192  [0.00%]
       16384  [0.00%]
       24576  [0.00%]
       32768  [0.00%]
       40960  [0.00%]
       49152  [0.01%]
       57344  [0.01%]
       65536  [0.01%]
       73728  [0.01%]
       81920  [0.01%]
       90112  [0.01%]
       98304  [0.01%]
      106496  [0.01%]
      114688  [0.01%]
      122880  [0.01%]
      131072  [0.02%]
      139264  [0.02%]
      147456  [0.02%]
      155648  [0.02%]
      163840  [0.02%]
  </code></pre>
  
  <p>Note that as the loop goes the output is printed on a separate lines. I know I can use <code>\r</code> <em>(carriage return)</em> to do that. But I have confusion where and how to use that.</p>