如何使用sys.argv

时间:2016-11-24 14:59:03

标签: python python-2.7

我在python 2.7上试过这个

import sys

a = int (sys.argv [1])
b = int (sys.argv [2])

c = a + b

结果如下:

Traceback (most recent call last):
   File "C:\gispy\Sample_scripts\ch02\add_version2.py", line 8, in <module>
     a = int (sys.argv [1])
IndexError: list index out of range

0 个答案:

没有答案