[英]Deleting the content of multiple csv file with python
I am using the following code to delete the content of a single csv file: 我正在使用以下代码删除单个csv文件的内容:
filename = "output.csv"
# opening the file with w+ mode truncates the file
f = open(filename, "w+")
f.close()
Is there a way to this at the same time to multiple csv files which are in the same folder? 有没有一种方法可以同时处理同一文件夹中的多个csv文件? Basically I want to keep the filenames and only to delete their content.
基本上,我想保留文件名,而只删除它们的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.