python - modify system environment variables

os.environ is a dictionary

We can directly operate on this dictionary to affect the environment variables of the current system runtime.

import them
os.environ['qikang'] = 'leslie'
for k,v in os.environ.items():
    print (k, v)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325168311&siteId=291194637