title: How to set a var if it exists in a dict?
body: <p>I'm querying an API endpoint which brings information about events. The number of attributes about each event can vary though. I now try to do the following:</p>
  
  <pre><code>for e in apiResult:
      event = Event()
      event.street = e['f_street']
      event.price = e['f_price']
      event.venue_name = e['f_venue_name']
      event.start = e['f_start']
      # and about 40 more..
      event.save()
  </code></pre>
  
  <p>But I occasionally get key errors. So for each attribute I need to check whether it exists. I could of course do this as follows:</p>
  
  <pre><code>if 'f_street' in e:
      event.street = e['f_street']
  if 'f_price' in e:
      event.price = e['f_price']
  # etc. etc.
  </code></pre>
  
  <p>but this doesn't seem very Pythonic. Does anybody know how I can (Pythonically) set an attribute to <code>event</code>, only if it exists in the <code>e</code> dictionary? All tips are welcome!</p>