Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
a = 0 if (a==0): print "a==0" print "hello"
我有很多打印“hello”的代码,我不能放一个 else 而只是 TAB 一切。有什么东西可以停止执行功能吗?
在 Python 程序中,使用空格来制表符要好得多。如果可以,请配置您的 IDE 来执行此操作。周围的括号(a==0)是多余的。
(a==0)
a= 0 if a == 0 : print "a==0" print "hello"
停止函数执行的最快方法是指令return。
return