用Python编写的CSV文件在每一行之间都有空行。
import csvwith open('thefile.csv', 'rb') as f: data = list(csv.reader(f)) import collections counter = collections.defaultdict(int) for row in data: counter[row[10]] += 1with open('/pythonwork/thefile_subset11.csv', 'w') as outfile: writer = csv.writer(outfile) for row in data: if counter[row[10]] >= 504: writer.writerow(row)
thefile.csv
thefile_subset1
.
子衿沉夜
三国纷争
相关分类