title: Unwanted blanks while writing data into csv using python
body: <p>I want to store the internet speed in a csv file,
  here is my code:</p>
  <pre><code>import speedtest
  import datetime
  import time
  import csv
  
  s = speedtest.Speedtest()
  
  
  def main():
      with open('test.csv', mode='w') as speedcsv:
          csv_writer = csv.DictWriter(speedcsv, fieldnames=['time', 'Download Speed', 'Upload Speed'])
          csv_writer.writeheader()
          while True:
              time_now = datetime.datetime.now().strftime(&quot;%H:%M:%S&quot;)
              downspeed = round((round(s.download()) / 1048576), 2)
              upspeed = round((round(s.upload()) / 1048576), 2)
              csv_writer.writerow({
                  'time': time_now,
                  'Download Speed': downspeed,
                  'Upload Speed': upspeed
              })
              time.sleep(60)
  
  
  if __name__ == &quot;__main__&quot;:
      main()
  </code></pre>
  <p>and here is how the csv is getting written:
  <a href="https://i.stack.imgur.com/S5YJJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S5YJJ.png" alt="enter image description here" /></a></p>
  <p>can anyone explain me what is going wrong here that there are these blanks in the csv????</p>