title: How do I print the lists of all the indices within defaultdict in Python 3?
body: <p>I defined a defaultdict as follows:</p>
  
  <pre><code>results=defaultdict(list)
  </code></pre>
  
  <p>In a for loop that reads through each line in my dictionary file, I generate a tempWordObject that contains the original word (originalWord), its alphabetized version (azWord), and the length of the word (wLength). I then append the object to a list based on its length:</p>
  
  <pre><code>results[tempWordObject.wLength].append(tempWordObject)
  </code></pre>
  
  <p>So, what I should end up with, is a defaultdict called results that has lists of words based on their lengths. So, for example, results[4] should contain all 4 letter words in a list. Please correct me if I'm misunderstanding what is happening.</p>
  
  <p>What I'm trying to do (for testing purposes and to generate results later) is print all lists I have in defaultdict after I'm done reading through the file. So, it will print the list of word objects defaultdict[1] in the first line, the list of word objects in defaultdict[2] in the second line, etc. I would also like to be able to print only a specific parameter when I do this.</p>
  
  <p>If it's of any help, I will have the length of the longest word (maxL) once the loop is done. </p>
  
  <p>I think part of the reason I couldn't get this working is due to me misunderstanding how ever is stored in defaultdict and/or how I'm storing it. An explanation would be much appreciated.</p>