Expand Environment Variable in Python on Mac - VicPhanDevOps/mac GitHub Wiki

• Type python3 and press the return key to go into the Python interactive shell.
image

• Type import os.path and press the return key to import the os.path module.
image

• Type print(“$< environment variable >”) and press the return key to get the environment variable literally and without expansion.
image

• Type os.path.expandvars(“$< environment variable >”) and press the return key to get the expanded environment variable this time around.
image

⚠️ **GitHub.com Fallback** ⚠️