forked from shibing624/python-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_ferq.py
More file actions
25 lines (24 loc) · 756 Bytes
/
get_ferq.py
File metadata and controls
25 lines (24 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf-8 -*-
# Author: XuMing <[email protected]>
# Data: 17/9/13
# Brief:
import sys
content = set()
with open("./ad_count.txt", encoding="utf-8") as f:
for line in f:
content.add(line.strip())
stop_words = ['.', '-', ' ', '%']
with open("./ad__count2.txt", mode="w", encoding="utf-8") as f:
for line in content:
parts = line.strip().split()
try:
name = parts[0]
count = parts[1]
for i in stop_words:
name = name.replace(i, "")
if not name.isnumeric():
if int(count) > 34548 and len(name) > 1:
f.write("\t".join([parts[0], count]))
f.write("\n")
except Exception:
pass