Open explorer on a file

前端 未结 5 2100
北海茫月
北海茫月 2020-11-28 03:21

In Python, how do I jump to a file in the Windows Explorer? I found a solution for jumping to folders:

import subprocess
subprocess.Popen(\'explorer \"C:\\pa         


        
5条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-28 03:50

    For some reason, on windows 7 it always opens the users Path, for me following worked out:

    import subprocess
    subprocess.call("explorer C:\\temp\\yourpath", shell=True)
    

提交回复
热议问题