我想用命令关闭vscode:
In [8]: cmd = "kill -9 $(pgrep Electron)"
In [11]: subprocess.Popen(cmd, shell=True)
Out[11]: <subprocess.Popen at 0x10d1d0438>
它有效,但是当我尝试不带shell = True的替代品时
In [13]: cmd = "kill -9 $(pgrep Electron)"
In [14]: cmd = shlex.split(cmd)
In [15]: cmd
Out[15]: ['kill', '-9', '$(pgrep', 'Electron)']
In [16]: subprocess.Open(cmd)
AttributeError: module 'subprocess' has no attribute 'Open'
如何启用预期的工作?