本文整理匯總了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)