How do I create a constant in Python?

后端 未结 30 3193
既然无缘
既然无缘 2020-11-22 09:07

Is there a way to declare a constant in Python? In Java we can create constant values in this manner:

public static          


        
30条回答
  •  我在风中等你
    2020-11-22 09:31

    You can use StringVar or IntVar, etc, your constant is const_val

    val = 'Stackoverflow'
    const_val = StringVar(val)
    const.trace('w', reverse)
    
    def reverse(*args):
        const_val.set(val)
    

提交回复
热议问题