擅长:python、mysql、java
<p>我不确定是否理解正确,但是<code>sys</code>模块具有属性<code>argv</code>,该属性是在命令行中传递的所有参数的列表。你知道吗</p>
<p>你知道吗测试.py地址:</p>
<pre><code>#!/usr/bin/env python
import sys
for argument in sys.argv:
print(argument)
</code></pre>
<p>本例将打印传递给脚本的每个参数,请记住第一个元素<code>sys.argv[0]</code>将始终是脚本的名称。你知道吗</p>
<pre><code>$ ./test.py hello there
./test.py
hello
there
</code></pre>