将Python输出转换为CSV文件

gg0vcinb  于 2022-09-21  发布在  Python
关注(0)|答案(1)|浏览(157)

我有500个文件和他们的文件大小。现在我想把它们放在CSV文件中。

Name    size
 A.jpg   16.3
 B.jpg   310.11

我已经在两个列表中转换了名称和价值。

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

它不起作用

xdnvmnnf

xdnvmnnf1#

import pandas as pd

read_file = pd.read_csv (r'Path where the Text file is storedFile name.txt')
read_file.to_csv (r'Path where the CSV will be savedFile name.csv', index=None)

相关问题