mirror of
https://github.com/Watchful1/PushshiftDumps.git
synced 2025-07-04 03:16:40 -04:00
Sort output
This commit is contained in:
parent
bb25896815
commit
435d36168c
1 changed files with 3 additions and 1 deletions
|
@ -315,9 +315,11 @@ if __name__ == '__main__':
|
|||
input_lines += 1
|
||||
field_counts[line.strip()] += 1
|
||||
|
||||
sorted_counts = sorted(field_counts.items(), key=lambda item: item[1], reverse=True)
|
||||
|
||||
output_counts = 0
|
||||
with open(f"{args.output}.txt", 'w') as output_handle:
|
||||
for field, count in field_counts.items():
|
||||
for field, count in sorted_counts:
|
||||
if count >= args.min_count:
|
||||
output_counts += 1
|
||||
output_handle.write(f"{field} {count}\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue