change values in a list - python
Posted
by ariel
on Stack Overflow
See other posts from Stack Overflow
or by ariel
Published on 2010-05-12T17:41:05Z
Indexed on
2010/05/12
17:54 UTC
Read the original article
Hit count: 165
I have this code:
a=[['a','b','c'],['a','f','c'],['a','c','d']]
for x in a:
for y in x:
if 'a' in x:
x.replace('a','*')`
but the result is:
a=[['a','b','c'],['a','f','c'],['a','c','d']]
and bot a=[['b','c'],['f','c'],['c','d']]
What should I do so the changes will last?
© Stack Overflow or respective owner