Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 看看下面。我不懂这个节目_Python 2.7 - Fatal编程技术网

Python 2.7 看看下面。我不懂这个节目

Python 2.7 看看下面。我不懂这个节目,python-2.7,Python 2.7,如何获得如下输出 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 我从获得了程序。您需要将脚本命名为script.

如何获得如下输出

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

我从

获得了程序。您需要将脚本命名为script.py,然后从命令行运行它,如下所示:

The script is called: script.py
Your first variable is: first
Your second variable is: 2nd
Your third variable is: 3rd

解释就在你链接的页面的一半
python script.py first 2nd 3rd