Use os.path.expandvars to expand the environment variables in the string, for example:
>>> os.path.expandvars('$C/test/testing')
'/stackoverflow/test/testing'
More Related Contents:
- How to set environment variables in Python?
- How to check type of files without extensions? [duplicate]
- Environment variable differences when using Paramiko
- Get a filtered list of files in a directory
- How can I search sub-folders using glob.glob module? [duplicate]
- Monitoring contents of files/directories? [duplicate]
- setting an environment variable in virtualenv
- Python: Platform independent way to modify PATH environment variable
- How to use Jupyter notebooks in a conda environment?
- Disable assertions in Python
- Why can’t environmental variables set in python persist?
- Does `anaconda` create a separate PYTHONPATH variable for each new environment?
- Check whether a path is valid in Python without creating a file at the path’s target
- In Python script, how do I set PYTHONPATH?
- Python causing: IOError: [Errno 28] No space left on device: ‘../results/32766.html’ on disk with lots of space
- Python: Exporting environment variables in subprocess.Popen(..)
- nltk doesn’t add $NLTK_DATA to search path?
- What is the use of python-dotenv?
- Set LD_LIBRARY_PATH before importing in python
- How can I access environment variables in Python?
- Launch Pycharm from command line (terminal)
- How to add to and remove from system’s environment variable “PATH”?
- How to get the PATH environment-variable separator in Python?
- “OSError: [Errno 17] File exists” when trying to use os.makedirs [duplicate]
- Loading environment modules within a python script
- Is it possible to set an environment variable from Python permanently?
- Bundling Data files with PyInstaller 2.1 and MEIPASS error –onefile
- How to use to find files recursively?
- Change current process environment’s LD_LIBRARY_PATH
- How to find the mountpoint a file resides on?