如何将变量从终端导入到外壳?

时间:2019-01-12 18:34:26

标签: python terminal command prompt

这里有一个业余问题,我现在知道如何在终端中使用ARGV命令,但是id喜欢做相反的事情,我不确定如何称呼它。

ex(空闲)

from sys import argv
script, one, two, three, four=argv
print("the script is called:", script)
print("the first variable is called:", one)
print("the second variable is called:", two)
print("the third variable is called:", three)
print("the fourth variable is called:", four)

在终端

documents/user python 3.py do this backwards lol

我(在终端)

('the script is called:', '3.py')
('the first variable is called:', 'do')
('the second variable is called:', 'this')
('the third variable is called:', 'backwards')
('the fourth variable is called:', 'lol')

它可以工作,但我希望最终输出在shell中而不是在终端中,我们将提供任何帮助

0 个答案:

没有答案