Answers for "how to define the location of a file that needs to be opened in python"

1

python how to open a file in a different directory in mac

import os
f = open (os.path.expanduser("~/Desktop/somedir/somefile.txt"))
Posted by: Guest on August-16-2020
0

how to open folder in python

import webbrowser

path = "C:/Users/Username/PycharmProjects"
webbrowser.open(path) # Opens 'PycharmProjects' folder.
Posted by: Guest on January-05-2021

Code answers related to "how to define the location of a file that needs to be opened in python"

Python Answers by Framework

Browse Popular Code Answers by Language