From c8696504c9d5de9620838d8aeba1bface16dabd4 Mon Sep 17 00:00:00 2001 From: minoplhy Date: Tue, 10 Aug 2021 12:26:44 +0700 Subject: [PATCH] Too Much Space . So i reduce --- excluder.py | 23 ++++++++++++++++++++++- maker_hosts.py | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/excluder.py b/excluder.py index 86c3c93..34d9f77 100644 --- a/excluder.py +++ b/excluder.py @@ -26,4 +26,25 @@ def add_file(incoming,excluded_in): with open(incoming, 'w') as f: f.writelines(set(lines)) crawler.sort(incoming) - os.remove(excluded_in) \ No newline at end of file + os.remove(excluded_in) + +def remove(incoming,input): + with open(incoming, 'r') as f: + lines = f.read().split() + with open(incoming, 'w') as f: + for line in lines: + if line.startswith(input) and input in line: + f.write(line.replace(input ,'')) + elif not line.startswith(input): + f.write('\n'.join([line + '\n'])) + with open(incoming ,'r') as f: + lines = f.read().split() + with open(incoming ,'w') as f: + for line in lines: + if line.strip(): + f.write('\n'.join([line + '\n'])) + with open(incoming, 'r') as f: + lines = set(f.readlines()) + with open(incoming, 'w') as f: + f.writelines(set(lines)) + crawler.sort(incoming) \ No newline at end of file diff --git a/maker_hosts.py b/maker_hosts.py index 9fb845b..9f09a97 100644 --- a/maker_hosts.py +++ b/maker_hosts.py @@ -37,7 +37,7 @@ def hostsbuilding(excluded ,incoming ,output): f.write('ff02::1 ip6-allnodes\n') f.write('ff02::2 ip6-allrouters\n') f.write('ff02::3 ip6-allhosts\n') - f.write('0.0.0.0 0.0.0.0\n\n\n') + f.write('0.0.0.0 0.0.0.0\n\n') for line in lines: if line.strip() and not line in exclude and not line.startswith('#'):