如何将多个变量从 Python 脚本传递到 c shell 脚本

How to pass more than one variable from Python script to c shell script

我知道如何将一个变量从 python 传递到 c shell 脚本,但我在将多个 python 变量传递到 c shell 脚本时遇到了问题。请让我知道我们如何实现这一目标。这是 link,我在这里知道将单个变量从 python 传递到 c shell 脚本。

How to pass the Python variable to c shell script

将每个参数作为单独的 argv 条目传递:

first_var='hello'
second_var='world'
subprocess.Popen(['program_name', first_var, second_var], shell=False)

相比之下,如果您想通过环境传递多个变量,它们都应该是env字典中的键:

subprocess.Popen(['program_name'], env={
  'first_var': first_var,
  'second_var': second_var,
})