Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to open file explorer in python

import os
import subprocess
FILEBROWSER_PATH = os.path.join(os.getenv('WINDIR'), 'explorer.exe')

def explore(path):
    # explorer would choke on forward slashes
    path = os.path.normpath(path)

    if os.path.isdir(path):
        subprocess.run([FILEBROWSER_PATH, path])
    elif os.path.isfile(path):
        subprocess.run([FILEBROWSER_PATH, '/select,', os.path.normpath(path)])
Comment

python open file from explorer

import sys
path = r'C:Program Files (x86)IronPython 2.7Lib'
sys.path.append(path)

import subprocess
subprocess.Popen('explorer "C:	emp"')
Comment

PREVIOUS NEXT
Code Example
Python :: python list only files not directories 
Python :: delete one pymongo 
Python :: summary in python 
Python :: prime number in python 
Python :: remove keys from dict python 
Python :: how explode by using two columns pandas 
Python :: print last exceuted query python 
Python :: login_required on class django 
Python :: how to reverse a list in python without using inbuilt function 
Python :: place legend on location matplotlib 
Python :: max float python 
Python :: django save vs create 
Python :: how to write post method using flask 
Python :: pandas max columns 
Python :: pandas cheat sheet pdf 
Python :: image on jupyter notebook 
Python :: find character in python 
Python :: python mean ndarray 
Python :: django boilerplate command 
Python :: django never_cache example 
Python :: regular expression to remove space python 
Python :: measure time per line python 
Python :: how to open a website using python 
Python :: root mean squared error python 
Python :: matplotlib boxplot colors 
Python :: python using datetime as id 
Python :: flask migrate 
Python :: python regex 
Python :: % operatior in python print 
Python :: beautiful soup 4 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =