Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



 2690

Help me Python Filter Email

by MrBMW - 04 April, 2020 - 04:47 PM
This post is by a banned member (MrBMW) - Unhide
This post is by a banned member (ZeroTolerance) - Unhide
148
Posts
19
Threads
4 Years of service
#2
(This post was last modified: 05 April, 2020 - 03:38 PM by ZeroTolerance.)
Code:
list2 = ['@hotmail', '@yahoo', '@gmail']

with open('email.txt', 'r') as f:
    content = f.readlines()
    for line in content:
        for i in list2:
            if i in line:
                with open(i + '.txt', mode='a+') as f2:
                    f2.write(line)

print('Finished')


just modify the list at line 1 and add the emails that you want

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)