Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from labb4uppgift1 import *
- def find_all_email(text):
- the_list = []
- at_index = text.find("@")
- if text.find("@") < 0:
- return the_list
- while at_index > 0:
- if find_first_email(text) == None:
- #the_list.append(find_first_email(text[text.find("@")+1:]))
- at_index = text.find("@", text.find("@")+1)
- text = text[text.find("@")+1:]
- else:
- the_list.append(find_first_email(text))
- at_index = text.find("@", text.find("@")+1)
- text = text[text.find("@")+1:]
- return the_list
- def test_find_all_email():
- print find_all_email("hej hej filip@live.se hej @hej")
- print find_all_email("filip@live.se hej filip@live.se hej filip@live.se")
- print find_all_email("hej hej filip@live.se")
- print find_all_email("hej @hej hej filip@live.se hej hej")
- print find_all_email("hej hej@ hej filip_kristofersson@live.se hej hej")
- print find_all_email("hej hej hej lars-filip@live.se hej hej")
- test_find_all_email()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement