inital commit
This commit is contained in:
24
scrapper/Basic/add_remove_text.py
Normal file
24
scrapper/Basic/add_remove_text.py
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
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")
|
||||
Reference in New Issue
Block a user