使用os.system
import os, subprocess
In [33]: result = os.system('tasklist')
In [34]: print(result)
0
# 返回0
使用os.popen
In [30]: result = os.popen('tasklist')
In [31]: result = result.read()
In [32]: for line in result.splitlines()[:5]:
...<