我不知道定義變量的規則。 爲什麼不能工作? 有沒有一種方法可以將多個變量從一個函數發送到另一個函數,還是需要重新定義每個函數中的變量以使它們最後一個?通過函數發送多個變量
def first():
great = 1
print(great)
second()
def second(great):
# Do I need to re-define great here
if great == 1:
cool = 3001
third(great, cool)
def third(great, cool):
if great > 1:
print(cool)
# To make great = 1 here?
first()
[Python的全局/本地變量(可能的重複http://stackoverflow.com/questions/13091357/python-global-local -variables) –