You are viewing a single comment's thread. Return to all comments →
def fun(s): import string as st validation_list = [] try: arroba_index, dot_index = s.index('@'), s.index('.') if arroba_index == 0: raise ValueError validation_list.append(all([True if ch in st.ascii_letters or ch in st.digits or ch in '_-' else False for ch in s[0: arroba_index]])) validation_list.append(all([True if ch in st.ascii_letters or ch in st.digits else False for ch in s[arroba_index + 1: dot_index]])) validation_list.append(all([True if ch in st.ascii_letters and len(s[dot_index +1:]) <= 3 else False for ch in s[dot_index +1:]])) except ValueError: return False return all(validation_list)
Seems like cookies are disabled on this browser, please enable them to open this website
Validating Email Addresses With a Filter
You are viewing a single comment's thread. Return to all comments →