title: python create a unexpected blank row below header
body: <p>My code below create csv file and then adding random data to it.</p>
  <p>Somehow, the first part of the code create a blank row below header.</p>
  <p>Can anyone please help to fix the code to remove this blank row?</p>
  <p>Thank you,</p>
  <p>Hary</p>
  <pre><code>header_list = [&quot;Firm&quot;, &quot;hour&quot;, &quot;unit sold&quot;, &quot;product code&quot;, &quot;dollar value&quot;]
  for i in range(3):
      # create file with header -----------
      with open(f'D:\\2000 transactions\\location_id_' + str(i) + '.csv', 'w',  newline='') as file:
          dw = csv.DictWriter(file, delimiter=',',fieldnames=header_list)
          dw.writeheader() # this line create a blank row below header
  
  
      # adding data to file ---------------
      for j in range(5):
          n = random.randint(1, 99)
          text = str(str(sp100_list['Name'].loc[n]) + ',' + str(random.randint(5, 20)) + ',' + str(random.randint(200, 1000)) + ',' + str(
              random.randint(100, 150)) + ',' + str(int(random.random() * 1000000)))
          myfile = open(f'D:\\2000 transactions\\location_id_' + str(i) + '.csv', 'a')
          myfile.write('\n' + text)
  
  
  </code></pre>