Python open folder and then focus to file

Viewed 527
import os
os.startfile(path)

With the above code i can open a folder in explorer (windows 10)

How can i focus to a specific file?

Example:

enter image description here

enter image description here

I search for a solution for most os (windows, ubuntu, mac...)

Edit: In windows with

import subprocess
subprocess.Popen(r'explorer /select,"'+path_with_file+'"')

it gives me the desired result.

0 Answers
Related