Search code examples
windowspython-3.xoperating-systemwindows-10windows-explorer

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


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.


Solution

  • I found a simple method.

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