Skip to content

Instantly share code, notes, and snippets.

@pythoncat1024
Forked from ladder1984/git_shell
Created August 2, 2017 15:11
Show Gist options
  • Save pythoncat1024/ad687253fec55e320f12c5fdb2dd22bd to your computer and use it in GitHub Desktop.
Save pythoncat1024/ad687253fec55e320f12c5fdb2dd22bd to your computer and use it in GitHub Desktop.
python执行git命令并得到结果
def git_shell(git_command):
try:
return os.popen(git_command).read().strip()
except:
return None
@pythoncat1024
Copy link
Author

pythoncat1024 commented Aug 2, 2017

调用示例:

print(bash_shell('git init'))
print(bash_shell('ls -al'))

给力

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment