title: How can I get pybtex to read an absent field as NULL instead of skipping the record?
body: <p>I have been using pybtex (using a modified version of <a href="https://stackoverflow.com/a/14061849/3038571">this</a>) to pass records from a .bib file into a .csv like so</p>
  <pre class="lang-py prettyprint-override"><code>from pybtex.database.input import bibtex
  import csv
  
  parser = bibtex.Parser()
  bibdata = parser.parse_file(&quot;../../bib/small.bib&quot;)
   
  # create csv file 
  with open('smallbib.csv', mode ='w') as csv_file:
      fieldnames = ['DOI',
                    'number']
      writer = csv.DictWriter(csv_file, fieldnames=fieldnames, lineterminator = '\n')
      writer.writeheader()
      for bib_id in bibdata.entries:
          b = bibdata.entries[bib_id].fields
          try:
              writer.writerow({'DOI': b['DOI'], 
                               'number': b[&quot;number&quot;],})
          except(KeyError):
              continue
  </code></pre>
  <p>However, if a field doesn't exist in the .bib file, this script simply ignores the entire record. How can I get my script to write NULL or a blank cell instead? Is it to do with my <code>except(KeyError)</code> statment?</p>
  <p><strong>sample input data</strong></p>
  <pre><code>@Article{adeniran2016n,
    number    = {3},
    doi       = {10.1021/acs.chemmater.5b05020},
  }
  
  @Article{blankenship2017cigarette,
    doi       = {10.1039/C7EE02616A},
  }
  </code></pre>