I can't figure out why my code is not working. I thought I had the list copied correctly:
Here is my code: ============ a=[[u'HF', []], [u')F', [u'75']], [u'RE', []], [u'C', []]] b=a[:] for index in reversed(range(0,len(a)-1)): if '75' in b[index][1]: b[index][1].remove('75') b[index][1].append('99') print a,'\n',b ============ but when it finishes, I get [[u'HF', []], [u')F', ['99']], [u'RE', []], [u'C', []]] [[u'HF', []], [u')F', ['99']], [u'RE', []], [u'C', []]] instead of the desired: [[u'HF', []], [u')F', ['75']], [u'RE', []], [u'C', []]] [[u'HF', []], [u')F', ['99']], [u'RE', []], [u'C', []]] why is this? -- http://mail.python.org/mailman/listinfo/python-list