import re mail = raw_input() #mail = "123@hu.123@we.i.com" pattern_split = re.compile(r"([\w\d\&\=\+\$\,\;\?\/\-\_\.\!\~\*\'\(\)\#]*@[\w\d-]+?\.)") pattern = re.compile(r"([\w\d\&\=\+\$\,\;\?\/\-\_\.\!\~\*\'\(\)\#]*)@([\w\d-]+?)\.") res = "" for item in pattern_split.split(mail):     match = pattern.match(item)     if match:         g1 = match.group(1)         g2 = match.group(2)         if len(g2) <= 119 and len(g1) >= 3:             res += (g1[:-3:] + "***" +"@"+g2+".")         else:             res += item     else:         res += item print res
直接把输入输出就过了50%了。。。
然后这样过了,别人的代码