How to access environment variable values?

后端 未结 12 1340
孤独总比滥情好
孤独总比滥情好 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:35

    You can access to the environment variables using

    import os
    print os.environ
    

    Try to see the content of PYTHONPATH or PYTHONHOME environment variables, maybe this will be helpful for your second question. However you should clarify it.

提交回复
热议问题