Python:如何在 Windows 资源管理器上打开文件夹(Python 3.6.2、Windows 10) [英] Python: How to open a folder on Windows Explorer(Python 3.6.2, Windows 10)
本文介绍了Python:如何在 Windows 资源管理器上打开文件夹(Python 3.6.2、Windows 10)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我将要打开的路径存储在名为 finalpath 的字符串中,该字符串如下所示:"./2.8 电影/英语/死硬系列"
If I store the path that i want to open in a string called finalpath which looks something like this: "./2.8 Movies/English/Die Hard Series"
那我如何在 Windows 资源管理器中打开它?(Windows 10)(Python 3.6.2)
then how do i open this in Windows Explorer?(Windows 10)(Python 3.6.2)
P.S 我知道很多人问过这个问题,但我没有发现他们清楚.请尽快答复.
P.S I know many people have asked this question but I did not find them clear. Please answer soon.
推荐答案
我找到了一个简单的方法.
I found a simple method.
import os
path = "C:/Users"
path = os.path.realpath(path)
os.startfile(path)
这篇关于Python:如何在 Windows 资源管理器上打开文件夹(Python 3.6.2、Windows 10)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文