Python的等效于“public static void main” [英] Python's Equivalent of "public static void main"

查看:136
本文介绍了Python的等效于“public static void main”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是Python相当于public static void main(String [] args){...}?我记得过去曾经使用它然后忘记了。

What is Python's equivalent of "public static void main(String[] args) { ... }"? I remember having used it in the past and then forgot.

我基本上想要记住的是一个功能,我认为包括一些下划线(__)......

What I'm basically trying to remember is a function which I think included some underscores (__)...

thx

推荐答案

#!/usr/bin/env python

import sys

def main(args):
    print args

if __name__ == '__main__':
    main(sys.argv)

编辑:模拟 void 返回。

这篇关于Python的等效于“public static void main”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆