- Nov
- 3
- 0
When I use an equals signs in a command line parameter to a python script it use the equal sign as white space.
#test.py
import sys
print("arg count=%u" %len(sys.argv))
print("sys.argv[0]=%s" %sys.argv[0])
print("sys.argv[1]=%s" %sys.argv[1])
if len(sys.argv) >= 3:
print("sys.argv[2]=%s" %sys.argv[2])
else:
print("no value in sys.argv[2]")
The output results for CMD and TCC 13 or 14.
[c:\]ver
TCC LE 13.04.63 Windows 7 [Version 6.1.7601]
[c:\]python e:\temp\test.py --path=c:\temp
arg count=3
sys.argv[0]=e:\temp\test.py
sys.argv[1]=--path
sys.argv[2]=c:\temp
[c:\]cmd
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
c:\>python e:\temp\test.py --path=c:\temp
arg count=2
sys.argv[0]=e:\temp\test.py
sys.argv[1]=--path=c:\temp
no value in sys.argv[2]
This makes writing command line parsing very difficult.
Can I report this as a bug?
J.R. Heisey
#test.py
import sys
print("arg count=%u" %len(sys.argv))
print("sys.argv[0]=%s" %sys.argv[0])
print("sys.argv[1]=%s" %sys.argv[1])
if len(sys.argv) >= 3:
print("sys.argv[2]=%s" %sys.argv[2])
else:
print("no value in sys.argv[2]")
The output results for CMD and TCC 13 or 14.
[c:\]ver
TCC LE 13.04.63 Windows 7 [Version 6.1.7601]
[c:\]python e:\temp\test.py --path=c:\temp
arg count=3
sys.argv[0]=e:\temp\test.py
sys.argv[1]=--path
sys.argv[2]=c:\temp
[c:\]cmd
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
c:\>python e:\temp\test.py --path=c:\temp
arg count=2
sys.argv[0]=e:\temp\test.py
sys.argv[1]=--path=c:\temp
no value in sys.argv[2]
This makes writing command line parsing very difficult.
Can I report this as a bug?
J.R. Heisey