为什么我不能把*作为命令行输入n python(ubuntu linux)?

时间:2016-10-27 08:01:42

标签: python python-2.x

打印变量操作时,我自己获取脚本名称。 *(星号)不被接受为命令行参数。

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)`

0 个答案:

没有答案