python中如何定义main方法 我们有时写的python模块需要自己测试, 简单方法就是定义main函数, 然后测试自己的模块接口。 def main(): test_yourCode() if __name__ == "__main__": main()