Skip to content

Instantly share code, notes, and snippets.

@c0des1ayr
Created February 10, 2025 00:23
Show Gist options
  • Select an option

  • Save c0des1ayr/2ee5d07549c8018ffa2d946d62a50c49 to your computer and use it in GitHub Desktop.

Select an option

Save c0des1ayr/2ee5d07549c8018ffa2d946d62a50c49 to your computer and use it in GitHub Desktop.
`pushpop`, a simple pushd/popd implementation for Python scripts
import os
dir_stack = []
def pushd(new_dir):
dir_stack.append(os.getcwd())
os.chdir(new_dir)
def popd():
os.chdir(dir_stack.pop(0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment