import re
re_ = re.compile(r'<?(\w*) ?(\w*)>?(\w*).?(\w*)@(\w{3,9})(.\w{3})$')
a = re_.match('<Someone PPP>someone@gmail.com').group()
b = re_.match('<Someone PPP>someone@gmail.com').group(1,2,3)
if a[0] == '<':
if b[0].lower() == b[2].lower():
print('True name')
print('Email is %s' % a)
结果是:
True name
Email is Someone PPP>someone@gmail.com
如果输入的是第一题的输入,则不会显示True name
執謎卜誤
结果是:
True name Email is Someone PPP>someone@gmail.com 如果输入的是第一题的输入,则不会显示True name