#! /usr/bin/python def main(): print("boo")
当我尝试在Python 3.3中运行该代码时,该代码不执行任何操作。没有错误或任何东西。怎么了
[tim@tim-arch ~]$ gvim script [tim@tim-arch ~]$ sudo chmod 775 script [tim@tim-arch ~]$ ./script [tim@tim-arch ~]$
您仍然必须 调用 该函数。
def main(): # declaring a function just declares it - the code doesn't run print("boo") main() # here we call the function