Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Function of os.environ in python

Tags:

python

I am new to python.I am not having any Knowledge of Python, i came across following line of python code

os.environ.get('IS_THIS_POSSIBLE', 'FALSE') == 'TRUE'

what does os.environ.get Do? Is it accessing something particular to OS internals.

like image 882
Eljay Avatar asked Oct 23 '25 10:10

Eljay


1 Answers

Yes, it is getting operation system's environment variables. For your code, it's returning the value of os-environment variable 'ENABLE_BONDING_ROUTER', return 'FALSE' if it does not exist.

To set an environment variable see the following post on Super User: What are PATH and other environment variables, and how can I set or use them?

like image 164
flycee Avatar answered Oct 26 '25 01:10

flycee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!