Python执行Windows cmd功能 - python

我知道您可以使用子进程通过Python脚本运行Linux终端命令

subprocess.call(['ls', '-l'])    # for linux

但是我找不到在Windows上执行相同操作的方法

subprocess.call(['dir'])         # for windows

使用Python而无需进行大量修改就可以吗?

我应该坚持使用老式的批处理文件吗?

python大神给出的解决方案

dir不是文件,而是内部命令,因此必须将shell关键字设置为True。

subprocess.call(["dir"], shell=True)