Код: Выделить всё
import sys
print ("This is the name of the script: "+ sys.argv[0])
print ("Number of arguments: " + str(len(sys.argv)))
print ("The arguments are: " + str(sys.argv))
Код: Выделить всё
python args.py -a -b
Код: Выделить всё
This is the name of the script: args.py
Number of arguments: 3
The arguments are: ['args.py', '-a', '-b']
Код: Выделить всё
args.py -a -b
Код: Выделить всё
This is the name of the script: C:\args.py
Number of arguments: 1
The arguments are: ['C:\\args.py']
Как это исправить?
Подробнее здесь: https://stackoverflow.com/questions/476 ... f-python-k