Created
August 9, 2018 18:09
-
-
Save pySamurai/4f4eb8c3474e8ff8e05ac28347113781 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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