1. We need to open the environment file using command
sudo nano /etc/environment
2. Update the variables in new line eg.
ABC = "test"
3. Save the file using ctl+o
4. Reboot the system.
5. Then we can call the environment variable using this method.
import os
info = os.environ.get('ABC')
print(info)
Output will be - test
sudo nano /etc/environment
2. Update the variables in new line eg.
ABC = "test"
3. Save the file using ctl+o
4. Reboot the system.
5. Then we can call the environment variable using this method.
import os
info = os.environ.get('ABC')
print(info)
Output will be - test
No comments:
Post a Comment