Last active
January 31, 2024 17:32
-
-
Save bthaman/f7b2b8db006313f73074fe3dcebf0952 to your computer and use it in GitHub Desktop.
Python script to list all environment variables, and split the 'path' variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" 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(';')] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks