I have a list that I want to change in a for loop. It changes in the loop but the changes are not persistant outside of the loop.<br>I thought lists were mutuable objects so I am a bit confused.<br><br>Sample Code....<br>#!/usr/bin/env python
<br>""" Testing lists """<br><br>mylist = [ 'One ', ' two', ' three ' ]<br>print mylist<br>for element in mylist:<br> element = element.strip()<br> print "<>" + element + "<>"
<br>print mylist<br><br><br>Sample Output....<br>['One ', ' two', ' three ']<br><>One<><br><>two<><br><>three<><br>['One ', ' two', ' three ']<br><br>