2024-04-27 05:00:40 发布
网友
谢谢!你知道吗
def hello(a,b): print "hello and that's your sum:" sum=a+b print sum import sys if __name__ == "__main__": hello(sys.argv[2])
它不适合我,我感谢你的帮助!!! 谢谢!你知道吗
sys
hello
这将导致:
import sys def hello(a, b): sum = a + b print "hello and that's your sum:", sum if __name__ == "__main__": hello(float(sys.argv[1]), float(sys.argv[2]))
如果看不到错误消息,很难说问题到底出在哪里,但有几件事会跳出来:
可能更多,但同样需要错误输出。你知道吗
以下是您可能想要的:
import sys def hello(a,b): print "hello and that's your sum:" sum=a+b print sum if __name__ == "__main__": hello(int(sys.argv[1]), int(sys.argv[2]))
sys
在全局范围内,而不是在函数末尾。你知道吗hello
,一个是不够的。你知道吗这将导致:
如果看不到错误消息,很难说问题到底出在哪里,但有几件事会跳出来:
可能更多,但同样需要错误输出。你知道吗
以下是您可能想要的:
相关问题 更多 >
编程相关推荐