Advertisement
Guest User

parse_emails

a guest
Jul 7th, 2016
2,217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. def parse_emails(text):  # Need to fix docstring
  2.     """
  3.    Takes a string from which you want to find a emails.
  4.    Returns a list with emails.
  5.    >>> text_emails = '''
  6.    ... mymail@mail.ru
  7.    ... nocom@gmail
  8.    ... nodomain@
  9.    ... @noname.ru
  10.    ... onlydomain.ru
  11.    ... MyMail@rambler.ru
  12.    ... CUPS@yandex.com
  13.    ... norm@YANDEX.COM
  14.    ... vlad1990@cobra.su
  15.    ... 12345@mail.com
  16.    ... domain@123.ru
  17.    ... domain@123.123
  18.    ... checksizeeeeeeeeeeeeee@mail.com
  19.    ... min@mail.ru
  20.    ... mi@mail.ru
  21.    ... m@gmail.com
  22.    ... '''
  23.    >>> parse_emails(text_emails)
  24.    ['mymail@mail.ru', 'MyMail@rambler.ru', 'CUPS@yandex.com',
  25.    'vlad1990@cobra.su', '12345@mail.com', 'domain@123.ru',
  26.    'checksizeeeeeeeeeeeeee@mail.com', 'min@mail.ru', 'mi@mail.ru']
  27.  
  28.    """
  29.     return EMAIL_REGEXP.findall(text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement