title: Python print to same line during loop
body: <p>I have the following loop which prints a period after each iteration:</p>
  
  <pre><code>for i in range(3):
      time.sleep(1)
      print('.')
  </code></pre>
  
  <p>This runs exactly as expected: a period is printed to the terminal on a new line in 1 second increments</p>
  
  <pre><code>.  # after 1 seconds
  .  # after 2 seconds
  .  # after 3 seconds
  </code></pre>
  
  <p>I want to change the output to print periods to the same line (so the output is more compact and easier to read). However, I have a problem when I change the code to the following:</p>
  
  <pre><code>for i in range(3):
      time.sleep(1)
      print('.', end='')
  </code></pre>
  
  <p>In this case, the single line of periods only print all at once when the for loop is complete:</p>
  
  <pre><code>...  # all after 3 seconds
  </code></pre>
  
  <p>Am I doing something wrong here or there a limitation with the python <code>print</code> statement?</p>