title: Multiple specific text files into CSV in python
body: <p>I have many text files in a very specific format that need to be read into a csv.  I can not seem to figure out how to get all the data in the format that I want in my csv.  I can get the file name and the header for the sheet, but none of the data is active in the sheet.  The text file is a s follows:</p>
  
  <pre><code>"market":"billing, MI"
  "mileStoneUpdates":"N"
  "woName":"Dsca_55354_55as0"
  "buildStage":"CPD"
  "designType":"Core"
  "woOverwrite":"Y"
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>import os
  import csv
  
  dirpath = 'C:\Usersnput\\'
  output = 'C:\Users\gputew Microsoft Excel Worksheet.csv'
  with open(output, 'w') as outfile:
      csvout = csv.writer(outfile)
      csvout.writerow(['market','mileStoneUpdates','woName','buildStage','designType','woOverwrite'])
  files = os.listdir(dirpath)
  
  for filename in files:
      with open(dirpath + '/' + filename) as afile:
          csvout.writerow([filename, afile.read()])
          afile.close()
  
  outfile.close()
  </code></pre>
  
  <p>Need to have spreadsheet with headers;market, mileStoneUpdates, woName, buildstage, designType, woOverwrite
  with the cells filled with billings...ect from each text file. </p>