更新时间:2022-10-27 22:15:27
One workaround is to structure your data differently, for example by using:
d = {'str1': 'before', 'str2': 'before'}
for i in d:
print d[i]
d[i] = "after"
The important thing is that this variable is mutable (as discussed in your link).