Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
下面是一个 shell 脚本的例子:
python command_name.py --shell positional_arg1 positional_arg2 --option optional_arg1 --True_flag
我只想能够从 python 脚本中调用它,这样我就可以遍历脚本,通过每个循环更改不同的参数。
import subprocess p = subprocess.Popen(["python", "--shell", "positional_arg1", "positional_arg2", "--option", "optional_arg1", "--True_flag"], shell=True, stdout=subprocess.PIPE) out, err = p.communicate()