open files in a folder python code example
Example 1: python open each file in directory
import os
for filename in os.listdir(os.getcwd()):
with open(os.path.join(os.cwd(), filename), 'r') as f:
Example 2: how to open folder in python
import webbrowser
path = "C:/Users/Username/PycharmProjects"
webbrowser.open(path) # Opens 'PycharmProjects' folder.