Use os.path.expandvars to expand the environment variables in the string, for example:
>>> os.path.expandvars('$C/test/testing')
'/stackoverflow/test/testing'
Use os.path.expandvars to expand the environment variables in the string, for example:
>>> os.path.expandvars('$C/test/testing')
'/stackoverflow/test/testing'