1 2 3 4 5 6 7 8
import os def expand_path(path): """Expand the user and shell variables in a path """ path = os.path.expanduser(path) return os.path.expandvars(path)