Guest User

Untitled

a guest
Dec 25th, 2018
532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import pandas as pd
  2. import os
  3. import re
  4.  
  5.  
  6. #fetching the mail adress through indexnumber out of the list
  7. with open('Protected/Protected G.txt', 'r') as file:
  8.  
  9. #creating the regex pattern to sort out the mail adresses
  10. rgx = 'S+@S+'
  11.  
  12. #read the file and convert the list into a string
  13. content = file.readlines()
  14. content_str = ''.join(content)
  15.  
  16. #get the mails out of the "list" with regex
  17. mails = re.findall(rgx, content_str)
  18.  
  19. #put each mailadress in a variable
  20. for item in mails:
  21. print(item)
  22.  
  23. Dummy-Dataframe:
  24.  
  25. Forename Last Name Email Protection
  26.  
  27. 1 John Kennedy John@gmx.net
  28.  
  29. 2 Donald Trump Donald@gmx.net
  30.  
  31. 3 Bill Clinton Bill@gmx.net
  32.  
  33. 4 Richard Nixton Richard@gmx.net
  34.  
  35. Finished Dataframe:
  36.  
  37. Forename Last Name Email Protection
  38.  
  39. 1 John Kennedy John@gmx.net x
  40.  
  41. 2 Donald Trump Donald@gmx.net o
  42.  
  43. 3 Bill Clinton Bill@gmx.net x
  44.  
  45. 4 Richard Nixton Richard@gmx.net x
Add Comment
Please, Sign In to add comment