title: Why does my python dict become unordered?
body: <p>I am using this to produce a plot of % of names starting with a certain letter over a span of years. When plotting (and printing) my diction (letter_d) the keys are disordered rather than being sequential like how they are added to the dict. Is there a way to fix this, I believe I am adding them to the dict in a sequential order. If not is there a way I can create connect the dots of my scatter plot in order to simulate the correct line plot?  </p>
  
  <pre><code>import csv
  import matplotlib.pyplot as plt 
  
  start = 1880
  stop = 1890
  x = []
  years = range(start, stop +1)
  print years
  letter_d = {}
  year_d = {}
  alphabet = ['Z']#,'C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
  
  for i in alphabet:
      letter_d[i] = 0
  
  for year in years:
      filename = 'yob' + str(year) + '.txt'
      z = open(filename)      
      year_d[int(year)] = 0
      letter_d[i] = year_d
      c = 0
      d = 0
      for line in z:
          y = line.strip().split(',')
          y.remove(y[1])
          c += int(y[1])
          if i in y[0]:
              d += int(y[1])
          year_d[year] = float(d)/float(c)            
          #x.append(y)
  #print year_d
  print year_d.keys()
  plt.plot(year_d.keys(), year_d.values())
  plt.show()
  </code></pre>