open all files from 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: read all files in folder python
import glob
print(glob.glob("/home/adam/*.txt"))