📜  获取所有环境变量python代码示例

📅  最后修改于: 2022-03-11 14:47:17.697000             🧑  作者: Mango

代码示例1
""" lists environment variables, and splits elements in path variable """
import os


for k, v in sorted(os.environ.items()):
    print(k+':', v)
print('\n')
# list elements in path environment variable
[print(item) for item in os.environ['PATH'].split(';')]