__author__ = 'jens' import util # Remove all double entries and entries that have an extension out of the second list print 'Base set' base = util.create_set(util.raw_multi_line_input(), lambda s: s.lower()) print 'Extensions to remove from base' to_del = util.create_set(util.raw_multi_line_input(), lambda s: s.lower()) for to_del_entry in to_del: base_set = set(base) for entry in base_set: if entry.lower().endswith(to_del_entry.lower()): base.remove(entry) util.copy_to_clipboard(sorted(base, key=str.lower))
__author__ = 'jens' import util import re # Extract email extensions from a list of mails use mailExtract.py first to get mails from text text = util.raw_multi_line_input() util.copy_to_clipboard(re.findall(r'@[\w\.-]+', ' '.join(text)))
__author__ = 'jens' import util # Read multi line input and count times each line occers # This will also trim all leading and trailing spaces multiLineInput = util.raw_multi_line_input() counter = dict() for line in multiLineInput: if line in counter: counter[line] += 1 else: counter[line] = 1 util.copy_to_clipboard(counter)
__author__ = 'jens' import util import re # Extracts belgian phone numbers from text lines = util.raw_multi_line_input() pattern = "(?:\+32|0032|0)(\d{8}\d?)" phones = [] for line in lines: phones.extend(re.findall(pattern, line.translate(None, '/. '))) phones = ["0032" + phone for phone in phones] util.copy_to_clipboard(phones)