Skip to content

Instantly share code, notes, and snippets.

@bthaman
Last active January 31, 2024 17:32
Show Gist options
  • Save bthaman/f7b2b8db006313f73074fe3dcebf0952 to your computer and use it in GitHub Desktop.
Save bthaman/f7b2b8db006313f73074fe3dcebf0952 to your computer and use it in GitHub Desktop.
Python script to list all environment variables, and split the 'path' variable
""" 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(';')]
@pablodz
Copy link

pablodz commented Nov 2, 2021

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment