Skip to content

Instantly share code, notes, and snippets.

@bsnux
Created August 26, 2025 19:11
Show Gist options
  • Select an option

  • Save bsnux/2749ed005783e6eabeeb2d6ddd1f0861 to your computer and use it in GitHub Desktop.

Select an option

Save bsnux/2749ed005783e6eabeeb2d6ddd1f0861 to your computer and use it in GitHub Desktop.
Running shell commands easily from Python (one-liner style)
from subprocess import check_output
def run_cd(cmd): return check_output(cmd, shell=True).decode('utf-8').split('\n')[:-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment