我的编辑器中只有以下内容:
def main ():
print("hello!"); //Also tried print "hello"
每次运行Run->“运行模块”时,Python shell都会重新启动并且不打印任何内容
答案 0 :(得分:1)
在Python中没有默认的主要行为,所以你通常想要做的是:
def main():
# your code
if __name__ == "__main__": # this means that the script was an argument for the interperet
main()