本文整理汇总了Python中sys.arv方法的典型用法代码示例。如果您正苦于以下问题:Python sys.arv方法的具体用法?Python sys.arv怎么用?Python sys.arv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sys
的用法示例。
在下文中一共展示了sys.arv方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _is_dev_mode
# 需要导入模块: import sys [as 别名]
# 或者: from sys import arv [as 别名]
def _is_dev_mode():
# Some embedded python interpreters won't have sys.arv
# For details, see https://github.com/webpy/webpy/issues/87
argv = getattr(sys, "argv", [])
# quick hack to check if the program is running in dev mode.
if os.environ.has_key('SERVER_SOFTWARE') \
or os.environ.has_key('PHP_FCGI_CHILDREN') \
or 'fcgi' in argv or 'fastcgi' in argv \
or 'mod_wsgi' in argv:
return False
return True
# When running the builtin-server, enable debug mode if not already set.
示例2: _is_dev_mode
# 需要导入模块: import sys [as 别名]
# 或者: from sys import arv [as 别名]
def _is_dev_mode():
# Some embedded python interpreters won't have sys.arv
# For details, see https://github.com/webpy/webpy/issues/87
argv = getattr(sys, "argv", [])
# quick hack to check if the program is running in dev mode.
if 'SERVER_SOFTWARE' in os.environ \
or 'PHP_FCGI_CHILDREN' in os.environ \
or 'fcgi' in argv or 'fastcgi' in argv \
or 'mod_wsgi' in argv:
return False
return True
# When running the builtin-server, enable debug mode if not already set.
示例3: main
# 需要导入模块: import sys [as 别名]
# 或者: from sys import arv [as 别名]
def main():
if len(sys.argv) < 2 or sys.arv[1] in ('-h','--help'):
print __doc__
else:
url = sys.argv[1]
asx = createASX(url)
os.startfile(asx)