title: How to prevent the elements in the dictionary constantly being updated?
body: <p>Here is the full code:</p>
  <pre><code>import re
  
  f = open('movies.item','r') 
  # First three item of movies.item below:
  #1|Toy Story (1995)|01-Jan-1995||http://us.imdb.com/M/title-exact?Toy%20Story%20(1995)|0|0|0|1|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0 
  #2|GoldenEye (1995)|01-Jan-1995||http://us.imdb.com/M/title-exact?GoldenEye%20(1995)|0|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0
  #3|Four Rooms (1995)|01-Jan-1995||http://us.imdb.com/M/title-exact?Four%20Rooms%20(1995)|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0
  empty_list = []
  for items in f:
      new_item = re.sub(r'\n', '', items)
      empty_list.append(new_item)
  movie_names = []
  splitted_list = None
  for i in range(len(empty_list)):
  
      splitted_list = empty_list[i].split(&quot;|&quot;)
      movie_names.append(splitted_list[1])
  
  genres = [&quot;Unknown&quot;, &quot;Action&quot;, &quot;Adventure&quot;, &quot;Animation&quot;, &quot;Children's&quot;,&quot;Comedy&quot;, &quot;Crime&quot;, &quot;Documentary&quot;, &quot;Drama&quot;,
  &quot;Fantasy&quot;, &quot;Film-Noir&quot;, &quot;Horror&quot;, &quot;Musical&quot;, &quot;Mystery&quot;,&quot;Romance&quot;, &quot;Sci-Fi&quot;, &quot;Thriller&quot;, &quot;War&quot;, &quot;Western&quot;]
  genres.reverse()
  genredict = {}
  last_dict = {}
  reversegenresum = []
  for i in range(len(empty_list)):
      x = list(empty_list[i])
      claer_list = []
      for k in range(len(x)):
          if x[k] != &quot;|&quot;:
              claer_list.append(x[k])
  
      claer_list.reverse()
      reverse_genre_data = claer_list[0:19]
      reversegenresum.append(reverse_genre_data)
      
  
  for i in range(3): #trying for 3 movie
      for j in range(len(genres)): 
          if reversegenresum[i][j] == '1':      
              genredict[genres[j]] = '1'
          last_dict[movie_names[i]] = genredict    
  
  
  print(last_dict) 
  </code></pre>
  <p>What am I trying to do?
  I try to match data from the file that named 'movies.item'. There are movies and their data information like '0|0|1|0'. If the value of the data is equal to 1 I need to match it with the corresponding category. But I can only do this for 1 movie. Although I do not get an error when I try to do it otherwise, all my data is shaped according to the last data. If you don't understand what I mean, please copy the code and try it yourself.</p>
  <p>Input :</p>
  <pre><code>{'Toy Story (1995)': {'Comedy': '1', &quot;Children's&quot;: '1', 'Animation': '1', 'Thriller': '1', 'Adventure': '1', 'Action': '1'}, 
   'GoldenEye (1995)': {'Comedy': '1', &quot;Children's&quot;: '1', 'Animation': '1', 'Thriller': '1', 'Adventure': '1', 'Action': '1'}, 
   'Four Rooms (1995)': {'Comedy': '1', &quot;Children's&quot;: '1', 'Animation': '1', 'Thriller': '1', 'Adventure': '1', 'Action': '1'}}  
  </code></pre>
  <p>What I want:</p>
  <pre><code>{'Toy Story (1995)': {'Animation': 1, &quot;Children's&quot;: 1, 'Comedy': 1}, 
   'GoldenEye (1995)': {'Action': 1, 'Adventure': 1, 'Thriller': 1}, 
   'Four Rooms (1995)': {'Thriller': 1},
  </code></pre>