title: Creating and Appending to a Dictionary of Lists?
body: <p>edit: the second link solved my problem, thank you!</p>
  
  <p>I have a global variable "messages", my keys will be "channel" and my values will be "message"</p>
  
  <p>I have tried:</p>
  
  <pre><code>messages = {}
  if channel not in messages:
      messages[channel] = message
  else:
      messages[channel].append(message)
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>messages = {}
  if channel not in messages:
      messages[channel][0] = message
  else:
      messages[channel].append(message)
  </code></pre>
  
  <p>How do I create a new dictionary key and append values to it?</p>
  
  <p>I'm sorry if this is a repeat question, I looked hard but I couldn't figure it out.</p>