Occasionally a command should be run from a specific directory. Here's a Python helper for this:
try/finally
ensures the original working directory is restored.- contextlib.contextmanager is a neat way to write things supporting the "with" statement ("Context Managers").
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.