how to open an external file in python

import subprocess    

path_to_notepad = 'C:\\Windows\\System32\\notepad.exe'
path_to_file = 'C:\\Users\\Desktop\\hello.txt'

subprocess.call([path_to_notepad, path_to_file])

Here is what the above code is Doing:
1. It’s creating a variable called path_to_notepad and assigning it the value of the path to notepad.exe.
2. It’s creating a variable called path_to_file and assigning it the value of the path to the hello.txt file.
3. It’s calling the subprocess.call() function and passing it a list of two items: the path to notepad.exe and the path to the hello.txt file.
4. The subprocess.call() function will launch notepad.exe and open the hello.txt file.