1. 程式人生 > >python 輸出環境變數

python 輸出環境變數

 

import os  
# Access all environment variables   
print('*---------------ENVIRON-------------------*')  
print(os.environ)  
print('*----------------HOME------------------*')  
# Access a particular environment variable   
print(os.environ['HOME'])  
print('*--------------PATH--------------------*
') print(os.environ['PATH']) print('*----------------------------------*')