Convert python output to csv file

Viewed 29

I have 500 files with their file size. Now I want to put them in a csv file.

Name    size
 A.jpg   16.3
 B.jpg   310.11

I have converted Name and Value in two lists.

Result=[]
for i in name:
    for j in value:
        Result.append(zip(i,j))
print(Result)

It is not working

1 Answers
import pandas as pd

read_file = pd.read_csv (r'Path where the Text file is stored\File name.txt')
read_file.to_csv (r'Path where the CSV will be saved\File name.csv', index=None)
Related