How to access environment variable values?

后端 未结 12 1520
孤独总比滥情好
孤独总比滥情好 2020-11-21 23:52

I set an environment variable that I want to access in my Python application. How do I get its value?

12条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 00:39

    As for the environment variables:

    import os
    print os.environ["HOME"]
    

    I'm afraid you'd have to flesh out your second point a little bit more before a decent answer is possible.

提交回复
热议问题