MCPcopy
hub / github.com/HuberTRoy/leetCode / numUniqueEmails

Method numUniqueEmails

String/UniqueEmailAddresses.py:41–68  ·  view source on GitHub ↗

:type emails: List[str] :rtype: int

(self, emails)

Source from the content-addressed store, hash-verified

39
40class Solution(object):
41 def numUniqueEmails(self, emails):
42 """
43 :type emails: List[str]
44 :rtype: int
45 """
46
47 result = 0
48 # local = {}
49 _emails = set()
50 ignore = re.compile(r'\+(.*)')
51 for i in emails:
52 x = i.split('@')
53 if len(x) > 2:
54 continue
55
56 if len(x) == 1:
57 continue
58
59 local = x[0]
60 domain = x[1]
61 local = local.replace('.', '')
62
63
64 local = re.sub(ignore, '', local)
65
66 _emails.add(local + '@' + domain)
67
68 return len(_emails)
69

Callers

nothing calls this directly

Calls 2

splitMethod · 0.80
addMethod · 0.80

Tested by

no test coverage detected