美文网首页
Pythonista20190310传递参数

Pythonista20190310传递参数

作者: 7300T | 来源:发表于2019-03-10 09:02 被阅读0次
Pythonista20190310传递参数

今天的练习我无法在ipad上测试
它需要shell


from sys import argv

script,first,scond,third = argv

print("The script is called:".format(script))
print("Your first variable is:".format(first))
print("Your scond variable is:".format(scond))
print("Your third variable is:".format(third))

如果是windows系统的话,你单击开始,在运行中输入powershell就会打开powershell。然后进入到你的工作目录。
像dos系统那样的。
输入类似下面的命令才能实现这段代码的功能。也就是说这段代码需要我们在python外调用python 再调用刚写的代码 并且传递更多的参数。
python pythonista20190310.py first 2nd 3rd

相关文章

网友评论

      本文标题:Pythonista20190310传递参数

      本文链接:https://www.haomeiwen.com/subject/xdzypqtx.html