Read Bash variables into a Python script

后端 未结 3 1011
攒了一身酷
攒了一身酷 2021-01-31 07:37

I am running a bash script (test.sh) and it loads in environment variables (from env.sh). That works fine, but I am trying to see python can just load in the variables already i

3条回答
  •  感情败类
    2021-01-31 08:05

    Assuming the environment variables that get set are permanent, which I think they are not. You can use os.environ.

    os.environ["something"]
    

提交回复
热议问题