Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import re
file_name = "path to file base.txt"
result_file_name = "path to file result.txt"
my_file = open(file_name, mode="r", encoding="UTF-8", )
results_file_read = open(result_file_name, mode="w", encoding="UTF-8")
my_text = my_file.read()
look_for = r"[\w.-]+@[A-Za-z-]+\.[\w.]+"
results = re.findall(look_for, my_text)
for item in results:
print(item)
results_file_read.write(item + "\n")
print("Total: " + str(len(results)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.