25 lines
661 B
Python
25 lines
661 B
Python
|
|
def remove_and_insert_text(text_to_remove):
|
|
|
|
source_file = 'proxies.txt'
|
|
destination_file = "proxies_block_ips.txt"
|
|
|
|
|
|
with open(destination_file, 'a') as file:
|
|
file.write('\n' + text_to_remove)
|
|
|
|
|
|
with open(source_file, 'r') as file:
|
|
content = file.read()
|
|
|
|
|
|
if text_to_remove in content:
|
|
|
|
modified_content = content.replace(text_to_remove, '')
|
|
cleaned_content = '\n'.join(line.strip() for line in modified_content.splitlines() if line.strip())
|
|
|
|
with open(source_file, 'w') as file:
|
|
file.write(cleaned_content)
|
|
else:
|
|
print("remove text not found")
|