这是我的蟒蛇hello.py
script:
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])
问题是它无法从Windows命令行提示符运行,我使用了这个命令:
C:\Python27>hello 1 1
但不幸的是它不起作用,有人可以帮忙吗?
-
import sys
退出 hello 函数。
- 参数应转换为 int。
- 包含的字符串文字
'
应该逃跑或者应该被包围"
.
- 您是否使用以下命令调用该程序
python hello.py <some-number> <some-number>
在命令行中?
import sys
def hello(a,b):
print "hello and that's your sum:", a + b
if __name__ == "__main__":
a = int(sys.argv[1])
b = int(sys.argv[2])
hello(a, b)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)