From 03ccb877cf959b7fc1d126f7fb5e5fed2341425b Mon Sep 17 00:00:00 2001 From: minoplhy Date: Sat, 7 Aug 2021 11:04:44 +0700 Subject: [PATCH] Fixing line merger problem --- excluder.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/excluder.py b/excluder.py index 181bcfe..cef402c 100644 --- a/excluder.py +++ b/excluder.py @@ -13,15 +13,9 @@ def add(incoming,input): crawler.sort(incoming) def add_file(incoming,excluded_in): - data= "" - with open(incoming) as fp: - data = fp.read() - with open(excluded_in) as fp: - data2 = fp.read() - data += "\n" - data += data2 - with open (incoming, 'w') as fp: - fp.write(data) + 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: