title: How to change the separator used in a CSV file?
body: <p>For a study project I have many many csv files that I need to change from comma (,) separated to semicolon (;) separated. So I only need to change the separator. </p>
  
  <p>I normally do it in Excel, but that takes a lot of work. And there I need to do it for every file separately plus Excel take a lot of time to do it. </p>
  
  <p>I have made a input and output folder. 
  That works fine in the code below. 
  The problem is:</p>
  
  <ol>
  <li>the comma is not getting changed in a semicolon. </li>
  <li>and for some reason it is adding a blank line, I don’t know why it does that. </li>
  </ol>
  
  <p>Can somebody give some tips?</p>
  
  <pre><code>import csv 
  from pathlib import Path
  
  folder_in = Path(r'C:\convert\Trajectory\In') 
  folder_out = Path(r'C:\convert\Trajectory\Out')
  
  for incsv in folder_in.iterdir():
      outcsv = folder_out.joinpath(incsv.name)
      with open(str(incsv), 'r') as fin, open(str(outcsv), 'w') as fout:
          reader = csv.DictReader(fin)
          writer = csv.DictWriter(fout, reader.fieldnames, delimiter=';')
          writer.writeheader()
          writer.writerows(reader)
  </code></pre>