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 mouse click 
Python :: python get base directory 
Python :: python dict to url params 
Python :: np.random.seed 
Python :: pandas columns add prefix 
Python :: change axis and axis label color matplotlib 
Python :: discord command addrole python 
Python :: django desc order 
Python :: python get keypressed value 
Python :: use sqlalchemy to create sqlite3 database 
Python :: python get num classes from label encoder 
Python :: serving static audio files with flask in react 
Python :: make a message appear after specified Time python 
Python :: python sqlite3 input multiple sql statement 
Python :: pickle save 
Python :: how to openn file dialog in tkinter 
Python :: start jupyter notebook with python 3.7 
Python :: dashes seaborn 
Python :: FizzBuzz FizzBuzz is a well known programming assignment, asked during interviews. 
Python :: x= [10] def List_ex(): x.append(20) def add_list(): x=[30,40] x.append(50) print (x) List_ex() print (x) add_list() print (x) 
Python :: python find second occurrence in string 
Python :: django create app 
Python :: how to convert index to column in pandas 
Python :: label encoder pyspark 
Python :: convert from object to integer python 
Python :: datetime python 
Python :: python discord bot wait for response 
Python :: gdscript 2d movement 
Python :: take multiple string as int in a list python 
Python :: get all paragraph tags beautifulsoup 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =