【发布时间】:2014-05-16 03:53:12
【问题描述】:
主函数调用之前定义的两个函数:“reg()”和“usa()”
我希望用户能够决定运行哪个函数。
但是,即使选择了“1”,“usa()”仍然会运行。
def main():
prompt = (input("If you would like to change the regional market numbers,
press 1."
"If you would like to change the national market, press 2."))
if prompt == 1:
a = reg()
a
else:
b = usa()
b
main()
【问题讨论】:
-
你用的是哪个版本的python?\
-
prompt在 Py3k 中始终为str,将其与int进行比较将始终为您提供False