有没有一种方法可以复制一个变量,使得当变量'a'的值改变时,它会自动将自身复制到变量'b'中?
例如:
a='hello'
b=a #.copy() or a function that will make a copy
a='bye'
# Is there a way to make
# 'b' equal 'a' without
# doing 'b=a'
print a
print b
我在使用Tkinter库时遇到了问题,我有一个已经存储在列表中的checkbutton,并且我尝试获取它所持有的变量。
但是需要5行代码才能到达该变量。
a
不就好了吗? - John Mee