Created
July 1, 2018 23:06
-
-
Save jingzhehu/7f6d900a6d46a365a12c2583cc71522b to your computer and use it in GitHub Desktop.
Run bash command in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shlex | |
import subprocess | |
def bash_cmd(command): | |
return subprocess.check_output(shlex.split(command)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment