在py_script.py:Windows无法在ARGS传递给python脚本
import os
import sys
l = len(sys.argv)
if l == 1:
print 'no args'
else:
if l > 1:
print 'first arg is %s'%sys.argv[1]
if l > 2:
print 'second arg is %s'%sys.argv[2]
现在要去命令行,我的winXP平台上:
d:\path\py_script.py 1 2
产量
first arg is 1
second arg is 2
尚未在我的Win7平台上获得
no args
如果我做
d:\path\python py_script.py 1 2
我得到
first arg is 1
second arg is 2
如何我可以让我的Win7环境的行为如预期?
一些细节:
win7是64位。
在win7上的py2.6.6,在winXP上的py 2.6.4。
适用于Win 7和2.7的我。 1. – 2011-05-24 11:36:18
Windows真的在用python解析argv :( – 2011-05-24 18:25:16