In bash generally we export environment variables like :
In some cases in our we need to set some environment variables inside our python programme to use it further.
But in Python, the if we try to use the system call to set the variable it never works :
It never works as, the python is the child process of bash and it cant change the env variable of Parent bash.
So here we have to use:
os.environ[‘VARIABLE’] = “value”
To get the values of any environment variable :