I have a list of emails and passwords like this:…
- User
I have a list of emails and passwords like this: <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:51128891A@ <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:Rebane12345 <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:198147gao! <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:mayalona* <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:shilianzhe1*
and i wanna extract all the emails ending in @hot.ee
- Assistant
If you want to extract emails that end with
@hot.ee, you can look for the pattern in the list that identifies these emails. Every email in your list follows the structureusername@domain, so for@hot.eeemails, you just need to find lines that contain this domain.A simple way to do this would be to iterate through each line of your list and check if it contains the substring
@hot.ee. Below is an example of how you can do this in Python:pythonemails_and_passwords = """ <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:51128891A@ <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:Rebane12345 <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:198147gao! <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:mayalona* <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>:shilianzhe1* """ # Split the string into lines lines = emails_and_passwords.strip().split("\n") # Filter and extract emails ending with @hot.ee hot_ee_emails = [line.split(':')[0] for line in lines if '@hot.ee' in line] print(hot_ee_emails) - User
its in a text file
- Assistant
If the list of emails and passwords is in a text file, you can read the contents of the file and then apply the same logic to extract emails ending with
@hot.ee. Here's how you can modify the previous Python script to read from a text file:python# Replace 'your_file.txt' with the actual name and path of your text file file_path = 'your_file.txt' # Initialize an empty list to store emails ending with @hot.ee hot_ee_emails = [] # Open the file and read line by line with open(file_path, 'r') as file: for line in file: # Strip any whitespace from the ends of each line cleaned_line = line.strip() # Check if the current line contains an email ending with @hot.ee if '@hot.ee' in cleaned_line: # Extract the email address (which is before the colon) email = cleaned_line.split(':')[0] # Append the extracted email to the list hot_ee_emails.append(email) # Print the list of extracted emails print(hot_ee_emails)