Skip to content

Instantly share code, notes, and snippets.

@fishyer
Created August 27, 2022 23:01
Show Gist options
  • Save fishyer/cd5928e412b03ed0ace59dbbb6bb286b to your computer and use it in GitHub Desktop.
Save fishyer/cd5928e412b03ed0ace59dbbb6bb286b to your computer and use it in GitHub Desktop.
python-cmd
def test():
print("-------------------[test]-------------------")
# print(sys.path)
# cmd=f'python --version'
# cmd=f'where cmd'
# cmd=f'where ipconfig'
cmd=f'where python'
# cmdCode = os.system(cmd)
# cmdResult = os.popen(cmd).read()
print("cmd:", cmd)
cmdResult = subprocess.getstatusoutput(cmd)
print("cmdResult:", cmdResult)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment