title: Python: Dictionary of matrices saves same value to every key from file
body: <p>I want to make a function which takes a data file and a dictionary where every value is a (???,12)matrix of nympy nan's, and return the dictionary with values from the data file. not all the data from the file is supposed to go into the dictionary.</p>
  
  <p>I've managed to get all the correct data and put it into the first matrix, the thing is every matrix is a copy of the first! I don't understand why this is since I'm taking all the data points line by line.</p>
  
  <pre><code>def read_temperature_dict(datfile, tempdictionary):
      ''''something'''
      dat = open(datfile)
      for key in tempdictionary:
          for line in dat.readlines():
              ID = line[:11]
              lineyear = line[11:15]
              lineyear = int(lineyear)
              try:
                  indexlineyear = year_to_index(lineyear)
              except:
                  continue
              jan = line[19:24]
              feb = line[27:32]
              mar = line[35:40]
              apr = line[43:48]
              may = line[51:56]
              jun = line[59:64]
              jul = line[67:72]
              aug = line[75:80]
              sep = line[83:88]
              oct = line[91:96]
              nov = line[99:104]
              dec = line[107:112]
              months = [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
              count = 0
              for temp in months:
                  newtemp = float(temp)
                  if count &lt;= 12:
                      if newtemp == -9999:
                          count += 1
                          continue
                      else:
                          newtemp = newtemp / 100.0
                          tempdictionary[ID][indexlineyear, count] = newtemp
                          count += 1
      dat.close()
      return tempdictionary 
  </code></pre>
  
  <p>So, if I write: </p>
  
  <pre><code>mydicttwo = read_temperature_dict('ghcnm.tavg.v3.3.0.20151011.qca_test.dat', mydict)  
  for key in mydicttwo:  
      print key, mydicttwo[key]  
  </code></pre>
  
  <p>The result is two identical keys:</p>
  
  <pre><code>20558362000 [[ 2.56 4.86 8.46 ..., 18.46 12.36 7.16] [ 5.26 1.76 8.26 ..., 18.66 11.26 5.96] [ 6.66 5.66 11.06 ..., 18.36 14.16 7.46] ..., [ 2.2 2. 6.3 ..., 17.6 9.9 5.6 ] [ 2.9 3.1 6.3 ..., 15.8 11.2 4.2 ] [ 3.4 4.1 6.3 ..., nan nan nan]]  
  21047600000 [[ 2.56 4.86 8.46 ..., 18.46 12.36 7.16] [ 5.26 1.76 8.26 ..., 18.66 11.26 5.96] [ 6.66 5.66 11.06 ..., 18.36 14.16 7.46] ..., [ 2.2 2. 6.3 ..., 17.6 9.9 5.6 ] [ 2.9 3.1 6.3 ..., 15.8 11.2 4.2 ] [ 3.4 4.1 6.3 ..., nan nan nan]]
  </code></pre>