我正在努力学习python。我正在做一个小程序,在静态数组中保存一些数字或字符串。我希望我的函数在一个数组中保存变量。但是在我完成我的功能之后,数组也不见了。如何在python中使数组成为静态的?我想在几个函数中改变它。在
py_ppl = []
def Dong():
alc1 = alc.get()
alc2 = alc1
alc1 = [0]
py_ppl.append(alc1[0])
py_ppl.append(alc2)
我是说像这样的。我用Tkinter Gui得到alc。在
Tags:
这个使用类变量的示例可能会对您有所帮助。init中声明的变量对于类的每个实例都是局部的,在类顶部声明的变量对于类的所有实例都是全局的。在
印刷品
^{pr2}$相关问题 更多 >
编程相关推荐