mirror of
https://github.com/minoplhy/filters-converter.git
synced 2024-12-22 10:08:08 +00:00
Regex attempt 7
This commit is contained in:
parent
76c15e5916
commit
8a982a849b
@ -18,6 +18,15 @@ with open(infile, 'w') as f1:
|
||||
f1.writelines(["%s\n" % item for item in file])
|
||||
f.close()
|
||||
|
||||
remove_words = ['localhost','localhost.localdomain','local','broadcasthost','loopback','ip6-localnet','ip6-mcastprefix','ip6-allnodes','ip6-allrouters','ip6-allhosts','ip6-loopback']
|
||||
|
||||
with open(infile, 'r') as f:
|
||||
lines = f.read().splitlines()
|
||||
with open(outfile, 'w') as f:
|
||||
for line in lines:
|
||||
if not line.endswith((tuple(remove_words))):
|
||||
f.write('\n'.join([line + '\n']))
|
||||
|
||||
with open(infile) as f:
|
||||
file = f.read().split('\n')
|
||||
for i in range(len(file)):
|
||||
@ -43,15 +52,6 @@ with open(infile, 'w') as f: # load file in write mode
|
||||
f.write('\n'.join([line + '\n']))
|
||||
f.close()
|
||||
|
||||
remove_words = ['localhost','localhost.localdomain','local','broadcasthost','loopback','ip6-localnet','ip6-mcastprefix','ip6-allnodes','ip6-allrouters','ip6-allhosts','ip6-loopback']
|
||||
|
||||
with open(infile, 'r') as f:
|
||||
lines = f.read().splitlines()
|
||||
with open(outfile, 'w') as f:
|
||||
for line in lines:
|
||||
if not line.endswith((tuple(remove_words))):
|
||||
f.write('\n'.join([line + '\n']))
|
||||
|
||||
with open(infile) as f:
|
||||
file = f.read().split('\n')
|
||||
for i in range(len(file)):
|
||||
|
Loading…
Reference in New Issue
Block a user