python coding program all files under directory code example
Example 1: python get files in directory
from pathlib import Path
for txt_path in Path("/path/folder/directory").glob("*.txt"):
print(txt_path)
Example 2: how to open folder in python
import webbrowser
path = "C:/Users/Username/PycharmProjects"
webbrowser.open(path) # Opens 'PycharmProjects' folder.