命令行参数解析模块 python 有两个内建的模块用于处理命令行参数,一个是 getopt,《Deep in python》一书中也有提到,只能简单处理命令行参数;另一个是 optparse,它功能强大,而且易于使用,可以方便地生成标准的、符合Unix/Posix 规范的命令行说明。 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/103763/showart_2114205.html
by checl1987_EE - Python文档中心 - 2009-12-08 16:05:46 阅读(2545) 回复(0)
[code]parser.add_option("-c", "--config", dest="config_file", action="store", help="read config from FILE", metavar="FILE") parser.add_option("-p", "--port", dest="listener_port", action="store", help="use PORT as listener port", metavar="PORT") [/code] 请问这里面的metavar是什么意思啊?
本帖最后由 gdp8899 于 2013-07-11 00:14 编辑
python is是种很特殊的语法,你在其它的语言应该不会见到这样的用法,今天就来说说这个把。 python is 按照自字面的意思就是什么东西是什么的,比如he is a boy,他是一个大男孩,而我们一般在写python程序的时候,也会用到一些判断,有的时候也会用到python is,比如判断下这个字符是否为none。 下面是python is的例子,比如我们来判断下一个字符串。 a = 'abc' if a is not None: print 'a is not none' 输出的结果是 a is not ...
#!/urs/bin/python contact = {} contact_list = [] select = ['1.insert','2.delete'] for i in select: print i print 'what\'s your choise:' get = raw_input('1 or 2') if get == 1: test = 1 while test==1: contact['name'] = raw_input("please input name: ") contact['phone'] = raw_input("please input phone number: ") contact_list.append(contact.copy()) go_on = raw_input("continue?\n") ...
好好学python,以后要养家吃饭的!!! 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/89259/showart_1885773.html
在系统管理技术手册(第二版)说得很清楚了,perl\python都是不错的啊,学哪个都一样,只要够用就行了,菜鸟学python算了,刚好本站里面又推荐了一本<python核心编程>所以说最好是根据现有的资料学,可能会更顺利些。