水蟒测试.py255255,0美元
who = sys.argv[1]
print sys.argv[1]
print who
print 'Number of arguments:', len(sys.argv), 'arguments.'
print 'Argument List:', str(sys.argv)
yanon(strip, Color(who))
上面的输出是
255,255,0
255,255,0
Number of arguments: 2 arguments.
Argument List: ['yantest.py', '255,255,0']
Traceback (most recent call last):
File "yantest.py", line 46, in <module>
yanon(strip, Color(who))
TypeError: Color() takes at least 3 arguments (1 given)
Segmentation fault
如何在Color函数中使用变量“who”?你知道吗
我试过(‘谁’),(‘谁’)这两种方法都不管用。你知道吗
谁是一根绳子。我不知道应该得到什么类型的变量color,但可能是int。你应该用“,”将who字符串分成3个子字符串,然后将每个子字符串转换成int或其他任何类型。你知道吗
错误意味着应该传递3个参数,但只传递1个参数。以下是两种实现方法:
脚本运行方式:
或者
脚本运行方式:
你应该关心争论的类型!你知道吗
相关问题 更多 >
编程相关推荐