Python study notes-os.environ module
1. Official explanation and function
environ is an image object of the environment corresponding to a string, and we need it when we want to use Python to obtain various information about the system. For example: environ['HOME'] represents the current user's home directory .
2. The key list of os.environ under Windows
3. The key list of os.environ under Linux
4. Detailed explanation of some key fields of os.environ
os.environ[‘HOMEPATH’]:当前用户主目录。
os.environ[‘TEMP‘]:临时目录路径。
os.environ[PATHEXT’]:可执行文件。
os.environ[‘SYSTEMROOT‘]:系统主目录。
os.environ[‘LOGONSERVER’]:机器名。
os.environ[‘PROMPT’]:设置提示符。
linux:
os.environ[‘USER‘]:当前使用用户。
os.environ[‘LC_COLLATE’]:路径扩展的结果排序时的字母顺序。
os.environ[‘SHELL’]:使用shell的类型。
os.environ[‘LAN’]:使用的语言。
os.environ[‘SSH_AUTH_SOCK‘]:ssh的执行路径。