L
Loris Caren
If
a = 'apple'
b = 'banana'
c = 'cabbage'
How can I get something like:-
for i in 'abc':
r = eval(i)
if r == 'cabbage': r = 'coconut'
actually change the object referenced by r rather
than creating a new object temporarily referenced by it?
I've tried playing with eval and exec without the desired
effect.
a = 'apple'
b = 'banana'
c = 'cabbage'
How can I get something like:-
for i in 'abc':
r = eval(i)
if r == 'cabbage': r = 'coconut'
actually change the object referenced by r rather
than creating a new object temporarily referenced by it?
I've tried playing with eval and exec without the desired
effect.