python执行时读取输入参数

from sys import argv

script, first, second, third = argv

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

  可以使用sys模块的argv类读取参数

  用户执行命令时就输入,本例中有三个参数。

posted @ 2017-11-01 15:03  hotfeng  阅读(3553)  评论(0编辑  收藏  举报