您的位置:首页 > 编程语言 > Python开发

Python:关于argv

2014-10-29 13:41 106 查看
代码test.py

# -*- coding: utf-8 -*-
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
print script


执行

D:\Python_Code>python test.py <strong><span style="color:#ff0000;">1 2 3 </span></strong>
The  script is called: test.py
Your first variable is : <span style="color:#ff0000;">1
</span>Your second variable is :<span style="color:#ff0000;"> 2</span>
Your third variable is : <span style="color:#ff0000;">3
</span>test.py


说明:参数是在用户执行命令时就要输入,就要用到argv
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: