-1

我正在阅读 Zed Shaw 的“Learning Python the hard way”,我在练习 13,我无法让 python 暂停,所以我可以看到代码的作用。

from sys import argv

script, first, second, third = argv

print "The script is called:", script
print "Your first variable is:", first
print "Your second variable is:", second
print "Your third variable is:", third

raw_input(' Press enter')
4

1 回答 1

3

你的脚本没有问题。您需要使用恰好 3 个参数调用脚本。否则会抛出错误。

使用参数运行应用程序:

  1. 打开命令提示符
  2. 运行命令:python <yourpath>\script.py arg1 arg2 arg3
于 2013-09-29T01:08:53.760 回答