How to use the dir/s command in Python?

后端 未结 5 1972
[愿得一人]
[愿得一人] 2021-01-13 07:13

Background

I use the command dir/s in batch files all the time. But, I am unable to call this using python. NOTE: I am

5条回答
  •  逝去的感伤
    2021-01-13 08:09

    As it's an inbuilt part of the command line you need to run it as:

    import subprocess
    subprocess.call("cmd /c dir /s")
    

提交回复
热议问题