import os
print 'setenv...',
print os.environ['USER'] # show current shell variable value
os.environ['USER'] = 'Brian' # runs os.putenv behind the scenes
os.system('python echoenv.py')
os.environ['USER'] = 'Arthur' # changes passed to spawned programs
os.system('python echoenv.py') # and linked-in C library modules
os.environ['USER'] = raw_input('?')
print os.popen('python echoenv.py').read()
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/8221.html