-2
main.py:从另一个模块中使用变量王氏while循环
import sys
sys.path.append('Pygame Projects')
import sub
from sub import *
loop = True
while loop:
print_hello()
true_the_another_loop()
while anotherLoop:
print_world()
sub.py:
def true_the_another_loop():
loop = False
anotherLoop = True
def print_hello():
print "hello"
def print_world():
print "world"
当我运行main.py,只会打印"hello"
。为什么"world"
未被打印?
在true_the_another_loop()
,行loop = Flase
似乎没有工作。
您不需要将返回值放入列表中 – 2014-10-05 19:48:21