0

I have a very simple problem, but can't get my head around the solution. I simply want to save the value of a list at some stage in the program e.g

aa=['a', 'b']
bb=aa
print bb
aa.append('c')
print bb

With the second print of bb, of course it includes 'c'. How can I save the value of aa as it was when first assigned to bb??

Psionman
  • 3,084
  • 1
  • 32
  • 65
  • See [How to clone or copy a list in Python?](http://stackoverflow.com/q/2612802/4014959) – PM 2Ring Jul 04 '15 at 08:53
  • Sorry. Tried, but couldn't find correct search terms – Psionman Jul 04 '15 at 10:16
  • Don't worry about it, Psionman. Your question is now one of the 185 "portals" to [this topic](http://stackoverflow.com/questions/linked/2612802?sort=newest) on SO, so it may help someone in the future with a similar problem. Duplicate questions aren't _that_ bad, but it _is_ bad when people answer them, since (ideally) we want all the answers to be in one place, and that's why we try to lock dupes ASAP. But this is really a topic for [Meta SO](http://meta.stackoverflow.com/questions/tagged/duplicate-questions)... – PM 2Ring Jul 04 '15 at 10:32

0 Answers0