filters-maker/excluder.py
2021-08-07 11:04:44 +07:00

24 lines
732 B
Python

import os
import crawler
def add(incoming,input):
with open(incoming, 'r') as f:
lines = f.read().split()
with open(incoming, 'a') as f:
f.write('\n'.join([input + '\n']))
with open(incoming, 'r') as f:
lines = set(f.readlines())
with open(incoming, 'w') as f:
f.writelines(set(lines))
crawler.sort(incoming)
def add_file(incoming,excluded_in):
with open(incoming, "wb") as outfile:
with open(excluded_in, "rb") as infile:
outfile.write(infile.read())
with open(incoming, 'r') as f:
lines = set(f.readlines())
with open(incoming, 'w') as f:
f.writelines(set(lines))
crawler.sort(incoming)
os.remove(excluded_in)