多语言展示
当前在线:845今日阅读:176今日分享:34

Python 打开文件夹(文件浏览器)的3个方法

Python 打开文件夹(文件浏览器)的3个方法。也可以用于打开本地文件。
工具/原料

python

方法1

#用subprocessimport subprocess# 目录subprocess.Popen(r'explorer 'path'')# 文件subprocess.Popen(r'explorer /select,'file'')

方法2

#用osimport osos.system('start explorer '+ path)

方法3

#用startfilefrom os import startfile# 打开文件夹窗口startfile('path')# 打开文件startfile('file')

推荐信息