mirror of
https://github.com/minoplhy/filters-maker.git
synced 2024-12-22 18:18:13 +00:00
34 lines
932 B
Python
34 lines
932 B
Python
|
|
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))
|
|
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, 'r') as f:
|
|
lines = set(f.readlines())
|
|
with open(incoming, 'w') as f:
|
|
f.writelines(set(lines))
|
|
sort(incoming)
|
|
|
|
def sort(incoming):
|
|
with open(incoming, 'r') as f:
|
|
lines = sorted(f.readlines())
|
|
with open(incoming, 'w') as f:
|
|
for line in lines:
|
|
f.write(line) |