title: Python: How to print values with carriage return on Terminal
body: <p>When i run the below script using PyCharm, no newline is printed during the download process.</p>
  
  <p>However when i run this script on Terminal, newlines are printed.    </p>
  
  <p>Here are the codes:</p>
  
  <pre><code>#!/usr/bin/env python3
  # -*- coding: utf-8 -*-
  
  
  import time
  import ssl
  import urllib.request
  
  
  def UrlOpen(url, filename):
      data = urllib.request.urlopen(url=url, context=ssl.SSLContext(ssl.PROTOCOL_SSLv23))
      size = int(data.headers.get("content-length"))
      with open(filename, "wb") as f:
          count = 0
          now = time.time()
          for i in data:
              count += len(i)
              f.write(i)
              print("\rSize: {} b, Downloaded: {} b, Completed: {} %, Elapsed: {} s, Speed: {} b/s"
                    .format(size,
                            count,
                            int(100 * count / size),
                            int(time.time() - now),
                            count / (time.time() - now)), flush=True, end="")  
  
  
  if __name__ == "__main__":
      test_url = "http://muhendislik.istanbul.edu.tr/insaat/wp-content/uploads/2015/10/temel_in%C5%9Faat%C4%B1.pdf"
      file_path = "/home/tanberk/Masaüstü/test.pdf"
      UrlOpen(test_url, file_path)
  </code></pre>
  
  <p>How can i print a single line when i use this script on Terminal? Thanks in advance.</p>