(dirname)
A context manager for operating in a different directory.
A context manager for operating in a different directory.
A context manager for operating in a different directory .
def cwd(dirname):
    """A context manager for operating in a different directory."""
    orig = os.getcwd()
    os.chdir(dirname)
    try:
        yield orig
    finally:
        os.chdir(orig)
def cwd ( dirname ) : orig = os . getcwd ( ) os . chdir ( dirname ) try : yield orig finally : os . chdir ( orig )