在python中,脚本是什么意思?

时间:2013-12-27 19:34:42

标签: 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

基本上,这里的脚本是指程序的文件吗?比如ex14.py?

我是python和prgramming的新手......如果这个问题对你们所有人来说都是愚蠢的。

1 个答案:

答案 0 :(得分:2)

使用参数1 2 3

运行它

<强>输出:

The script is called: E:\Proyectos\Eclipse\Python\Test\__init__.py
Your first variable is: 1
Your second variable is: 2
Your third variable is: 3

第一行打印脚本名称。引用Python文档:

  

... argv [0]是脚本名称(取决于操作系统是否为完整路径名)。

以下3行只打印我通过1 2 3的参数。

相关问题