Python: How to open a folder on Windows Explorer(Python 3.6.2, Windows 10)

Vikhyat Agarwal picture Vikhyat Agarwal · Dec 14, 2017 · Viewed 42.4k times · Source

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.

Answer

Vikhyat Agarwal picture Vikhyat Agarwal · Jan 4, 2018

I found a simple method.

import os
path = "C:/Users"
path = os.path.realpath(path)
os.startfile(path)