Python:如何在 Windows 资源管理器中打开文件夹(Python 3.6.2、Windows 10) [英] Python: How to open a folder on Windows Explorer(Python 3.6.2, Windows 10)

查看:20
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆