How to create environment variables in Python

Posted on: March 7th, 2023
By: Tadeo Martinez

Make sure to import the “os” module

import os

In the console, type the following:

export VARIABLE_NAME=VARIABLE_VALUE

You can access them from the code with the following:

os.environ.get('VARIABLE_NAME')

Have any questions or comments? Write them below!


Leave a Reply

Your email address will not be published. Required fields are marked *