import csv
import os
csv_file = open(‘files.csv’, ‘w’, newline=”)
csv_writer = csv.writer(csv_file)
for file in os.listdir():
if file.endswith(‘.txt’):
csv_writer.writerow([file])
csv_file.close()
import csv
import os
csv_file = open(‘files.csv’, ‘w’, newline=”)
csv_writer = csv.writer(csv_file)
for file in os.listdir():
if file.endswith(‘.txt’):
csv_writer.writerow([file])
csv_file.close()