I have the local path (parent directory) and I would like to extract only the paths that contain csv and saves them in a csv file.
What I tried so far?
import os
directory = os.path.join("path/to/dir","path")
for root,dirs,files in os.walk(directory):
for file in files:
if file.endswith(".csv"):
f=open(file, 'r')
f.close()
This does not extract all csv and saves it. How do I do that?