title: Append to the python's dictionary key:value
body: <p>I have a question about the dictionary in python, in the reference page: <a href="http://docs.python.org/tutorial/datastructures.html#dictionaries" rel="nofollow">http://docs.python.org/tutorial/datastructures.html#dictionaries</a> . </p>
  
  <blockquote>
    <p>"You can’t use lists as keys, since lists can be modified in
    place using index assignments, slice assignments, or methods like
    append() and extend()."</p>
  </blockquote>
  
  <p>But what does it mean to append the value of a python dictionary?</p>
  
  <pre><code># A simple program that keep track of the line number(s) a word appeared in the novel
  myDictionary = {} 
      with open('novel.txt') as book:
          lineNumber = 1
          for line in book:
              # cleaned is a helper function to clean up the line
              for word in cleaned(line).split():
                  if word in myDictinoary:
                      myDictionary[word].append(lineNumber)
                  else:
                      myDiciontary[word]=[lineNumber]
              lineNumber += 1
  </code></pre>
  
  <p>What exactly is going on when <code>myDictionary[word].append(lineNumber)</code> ? It seems to me a list, I want to be sure, the value of a key can be list (or in this case it is an Tuples)? <strong>What kind of data type exactly can be used as a value? When I want the key to store multiple values.</strong></p>