Question:
This is a small part in a bigger project. I'd like to believe I'm good at understanding delimiters and CSVs but I don't know what to do or what to ask.
Dumb question, how can I isolate the strings from this list and print them?
(0, 'img_10.jpg')
(1, 'img_8.mp4')
(2, 'img_31.mp4')
(3, 'img_30.mp4')
(4, 'img_9.mp4')
(5, 'img_12.jpg')
(6, 'img_20.mp4')
(7, '.DS_Store')
(8, 'img_21.mp4')
(9, 'img_35.mp4')
Desired output:
'img_10.jpg'
'img_8.mp4'
'img_31.mp4'
'img_30.mp4'
'img_9.mp4'
'img_12.jpg'
'img_20.mp4'
'.DS_Store'
'img_21.mp4'
'img_35.mp4'
My script below:
import glob, os
import sys
import csv
folder_path = "path"
list = os.listdir(folder_path)
with open("files.txt", "w", newline='\n', encoding='utf-8') as csvfile:
i = 0
for file in enumerate(list):
csvfile.write(str(file) + "\n")
print(file)