2016-02-19 24 views

回答

1

你必須使用一個全局變量:

v = "mytext" 

def f(): 
    global v 
    v = "newtext" 

f() 

print(v) 

輸出:

def f(): 
    global v 
    v = "newtext" 
1

使用global v你的方法裏面:

newtext