On this page
  1. ntpath.expandvars
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

ntpath.expandvars

Prev: ntpath.expanduser | Up: ntpath | Next: ntpath.getatime
Rel: ntpath.abspath, ntpath.basename, ntpath.commonpath, ntpath.commonprefix
Ref: docs.python.org — ntpath.expandvars
Tags: #public #python3 #stdlib #ntpath


Import

import ntpath
from ntpath import expandvars

Signature & Overview

ntpath.expandvars(path)

Expand shell variables of the forms $var, ${var} and %var%.

Usage

import ntpath, os

os.environ['DEMO_P'] = 'ok'
try:
    assert ntpath.expandvars('$DEMO_P') == 'ok'
finally:
    os.environ.pop('DEMO_P', None)

Gotchas

REPL Inspect

from ntpath import expandvars
help(expandvars)

Linked from

Related notes