Advertisement
Guest User

Untitled

a guest
Dec 28th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. ## Suppose we have a text with many email addresses
  2. str = 'purple alice@google.com, blah monkey bob@abc.com blah dishwasher'
  3.  
  4. ## Here re.findall() returns a list of all the found email strings
  5. emails = re.findall(r'[\w\.-]+@[\w\.-]+', str)
  6. ## ['alice@google.com', 'bob@abc.com']
  7. for email in emails:
  8. # do something with each found email string
  9. print email
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement