title: Python reset items in a list to their initial values
body: <p>I have several lists of lists, and I want to be able to edit the items in the lists throughout my code, and then reset them all to their initial values later.</p>
  
  <p>Here's an example:</p>
  
  <pre><code>list_a = [0, 1, 2]
  list_b = [list_a, 3, 4]
  list_c = [6, 7]
  list_d = [8, 9]
  lists = [0, list_b, 5, list_c, list_d]
  #As you can see, lists are of varying length, and sometimes nested multiple times.
  
  print(lists)
  Out&gt;&gt;&gt; [0, [[0, 1, 2], 3, 4], 5, [6, 7], [8, 9]]
  
  #Currently, I'm saving the important items of "lists" in the first item, like this:
  lists[0] = lists[1:]
  
  #Then I edit the values of various items, like this:
  lists[1][0][2] = 0
  lists[2] = 0
  lists[3][1] = 0
  lists[4][1] = 0
  
  print(lists[1:])
  Out&gt;&gt;&gt; [[[0, 1, 0], 3, 4], 0, [6, 0], [8, 0]]
  
  #Then I try to reset those values to the originals that I stored in lists[0]
  lists[1:] = lists[0]
  
  print(lists[1:])
  Out&gt;&gt;&gt; [[[0, 1, 0], 3, 4], 5, [6, 0], [8, 0]]
  </code></pre>
  
  <p>As you can see, this method works for list[2] because that item is a value, and not a nested list. It seems that even though I use [1:] to make a copy in lists[0], the references to nested lists are what get copied, rather than the values in those nested lists.</p>
  
  <p>How can I properly copy the values of lists[1:] into lists[0] and then back again, without having both copies reference the same index?</p>
  
  <p>Or perhaps there's a simpler way to achieve the same intended result, returning all items in lists to their original values?</p>