def getmail(l_str):
str_mail = []
for i in l_str:
if isinstance(i, str):
nPos = i.find('@')
if nPos > 0:
fon = ""
pos = i[nPos : len(i)]
for j in range(nPos - 1, 0, -1):
if i[j].isdigit() or i[j].isalpha():
fon = i[j] + fon
else:
break
cur_email = fon + pos
str_mail.append(cur_email)
if len(str_mail) == 0:
str_mail.append("None")
return str_mail
l1=['a', 'b', 'c', 'd', 'E-Mail:abcdefg@qq.com','e','f','g','h','i','j']
l2=[1,2,3,4, 'xyz135@163.com', 5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
l3=['a', 'b', 'c', 'd', '邮箱:123@gmail', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm']
l4=['a', 'b', 'c', 'd',5,6,7,8,9,10,11,12,'h', 'i', 'j', 'k', 'l', 'm']
mails = [];
mails.append(getmail(l1)[0])
mails.append(getmail(l2)[0])
mails.append(getmail(l3)[0])
mails.append(getmail(l4)[0])
print mails