打印变量操作时,我自己获取脚本名称。 *(星号)不被接受为命令行参数。
from sys import argv
script,operation = argv
print "your script name is %s" % script
print "you have choosen to perform the following opertion : %s" % operation
string = "enter the first operand "
a = int(raw_input(string))
b = int(raw_input("enter the second operand "))
if (operation == "addition" or operation == "+"):
print "the addition of %d and %d is %d" % (a,b,a+b)
elif (operation == "subtraction" or operation == "-"):
print "the subtraction of %d and %d is %d" % (a,b,a-b)
elif (operation == "multiplication" or operation == '*'):
print "the multiplication of %d and %d is %d" % (a,b,a*b)
elif (operation == "division" or operation == "/"):
print "the division of %d by %d is %d" % (a,b,a/b)`