title: append dictionary values python from if condition one liner
body: <p>I have an empty dictionary <code>hashtags_dict</code> where i would like to fill up with multiple values for each key when it satisfies a condition. <code>haystack_types</code>contains the keys</p>
  
  <pre><code>for (some_loop):
    eggs = get_new_egg()
    if (needle):
      for category in haystack_types: 
        try:
          hashtags_dict[category].append(eggs if needle in haystack_types[category])
        except KeyError:
          hashtags_dict[category] = [eggs if needle in haystack_types[category]]
  </code></pre>
  
  <p>There is a syntax error with in the <code>try</code> block.
  I would like to do it in a one-liner.</p>