title: Value in Dictionary is not always replaced
body: <p>I want to replace values in a <code>dictionary</code> with new values. However, sometimes they get replaced and sometimes not...</p>
  <p>The file can be downloaded here: <a href="https://easyupload.io/imkzb9" rel="nofollow noreferrer">https://easyupload.io/imkzb9</a></p>
  <pre><code>with open('zip_codes_germany.json') as originalFile:
      zipCodes = json.load(originalFile)
      for index, feature in enumerate(zipCodes):
          if feature['place'] == 'Berlin':
              zipCode = feature['zipcode']
              newQuery = f&quot;https://nominatim.openstreetmap.org/search?postalcode={zipCode}&amp;country=Germany&amp;format=json&quot;
              with urllib.request.urlopen(newQuery) as response:
                  jsonData = json.loads(response.read())
                  try:
                      feature['community'] = jsonData[0]['display_name']
                      zipCodes[index] = feature
                  except IndexError:
                      print(zipCode) # only done once
              time.sleep(2)
      with open('zip_codes_germany_2.0.json', 'w') as newFile:
          newFile.write(json.dumps(zipCodes))
  </code></pre>
  <p>Now, when searching for the <code>zipcode=10997</code>, the original value <code>Berlin, Stadt</code> for the key <code>community</code> is still there.
  Searching for the <code>zipcode=10318</code>, the value that the OSM API returns in <code>display_name</code> replaced the old <code>community</code> value. Why is that?</p>