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"
then how do i open this in Windows Explorer?(Windows 10)(Python 3.6.2)
P.S I know many people have asked this question but I did not find them clear. Please answer soon.
In order to do so, we have to import the filedialog module from Tkinter. The File dialog module will help you open, save files or directories. In order to open a file explorer, we have to use the method, askopenfilename(). This function creates a file dialog object.
To find the current working directory in Python, use os. getcwd() , and to change the current working directory, use os. chdir(path) .
To run Python scripts with the python command, you need to open a command-line and type in the word python , or python3 if you have both versions, followed by the path to your script, just like this: $ python3 hello.py Hello World! If everything works okay, after you press Enter , you'll see the phrase Hello World!
I found a simple method.
import os path = "C:/Users" path = os.path.realpath(path) os.startfile(path)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With