import re def Phone_Number(s): s = str(s) s = s.translate(str.maketrans("", "", ",.-'\"():|*`;+/!&?$°@#")) s.replace('\.0', '') s = re.sub('\D', '', s) Prefixes = ["353", "00353", "0353", "00", "01" , "021", "022", "023", "024", "025", "026", "027", "028", "029", "0402", "0404", "041", "042", "043", "044", "045", "046", "047", "048", "049", "0504", "0505", "051", "052", "053", "056", "057", "058", "059", "061", "062", "063", "064", "064", "065", "066", "067", "068", "069", "071", "074", "090", "091", "093", "094", "095", "096", "097", "098", "099" ] for n in Prefixes: if s.startswith(n): s = s.replace(n,"") if s.startswith('8') == True and len(s) == 9: s = '0' +s if len(s) < 6: s = "" if len(s) > 10: s = "" Contains = ['00000', '123456'] if any(c in s for c in Contains): s = "" return s
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter