Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. from labb4uppgift1 import *
  2.  
  3. def find_all_email(text):
  4. the_list = []
  5. at_index = text.find("@")
  6. if text.find("@") < 0:
  7. return the_list
  8. while at_index > 0:
  9. if find_first_email(text) == None:
  10. #the_list.append(find_first_email(text[text.find("@")+1:]))
  11. at_index = text.find("@", text.find("@")+1)
  12. text = text[text.find("@")+1:]
  13. else:
  14. the_list.append(find_first_email(text))
  15. at_index = text.find("@", text.find("@")+1)
  16. text = text[text.find("@")+1:]
  17. return the_list
  18.  
  19. def test_find_all_email():
  20. print find_all_email("hej hej filip@live.se hej @hej")
  21. print find_all_email("filip@live.se hej filip@live.se hej filip@live.se")
  22. print find_all_email("hej hej filip@live.se")
  23. print find_all_email("hej @hej hej filip@live.se hej hej")
  24. print find_all_email("hej hej@ hej filip_kristofersson@live.se hej hej")
  25. print find_all_email("hej hej hej lars-filip@live.se hej hej")
  26.  
  27. test_find_all_email()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement