I use python 2.7. I have data in file 'a':
[email protected];description1
[email protected];description2
myname3@this_is_ok.ok;description3
[email protected];description4
[email protected];description5
[email protected];description7
I read this file like:
with open('a', 'r') as f:
data = [x.strip() for x in f.readlines()]
i have a list named bad:
bad = ['abc', 'qwe'] # could be more than 20 elements
Now i'm trying to remove all lines with 'abc' and 'qwe' after @ and write the rest to the newfile. So in newfile should be only 2 lines:
myname3@this_is_ok.ok;description3
[email protected];description7
I've been tryin to use regexp (.?)@(.?);(.*) to get groups, but i don't know what to do next.
Advice me, please!