#Try to modified global variables with user-defined function (Does it works?)=>(YES!!)
var = "[global]"
def fun():
var = "[local]"
print (var)
global var
var ="[reset global]"
print (var)
fun()
print (var)
------------------執行結果:--------------------------
[global]
[local]
[reset global]
沒有留言:
張貼留言