【发布时间】:2017-02-08 03:14:32
【问题描述】:
我不知道定义 var 的规则。 为什么这不起作用? 有没有一种方法可以将许多变量从一个函数发送到另一个函数,或者我需要重新定义每个函数中的变量以使其持久?
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 if-statement int