go_from_altered_cwd

pyhelpers.dirs.go_from_altered_cwd(dir_name, **kwargs)

Get the full pathname of an altered working directory.

Parameters
  • dir_name (str or os.PathLike[str] or bytes or os.Path[bytes]) – name of a directory

  • kwargs – [optional] parameters of the function pyhelpers.dir.cd()

Returns

full pathname of an altered working directory (changed from the directory dir_name)

Return type

str

Examples:

>>> from pyhelpers.dirs import go_from_altered_cwd
>>> import os

>>> cwd = os.getcwd()
>>> cwd
'<cwd>'

>>> # If the current working directory has been altered to "<cwd>\test", and
>>> # we'd like to set it to be "<cwd>\target"
>>> a_cwd = go_from_altered_cwd(dir_name="target")
>>> a_cwd
'<cwd>\target'