python code reading system environment variables

The development process commonly used content covered up, the following code is the code section to read about the python system environment variables, the code should be the farmers are of some use.
! # / usr / bin / Python the env
#
# [SNIPPET_NAME: AN Environmental the Read variable]
# [SNIPPET_CATEGORIES: OS]
# [SNIPPET_DESCRIPTION: Print the Read and Environmental variable A GIVEN]
# [SNIPPET_AUTHOR: Jono Bacon <[email protected]> ]
# [SNIPPET_LICENSE: the GPL]

import os

# display the USERNAME environmental variable
print os.getenv('USERNAME')




 

Guess you like

Origin www.cnblogs.com/poplar515/p/11257652.html