Discuss / Python / 两个作业放一块~

两个作业放一块~

Topic source

執謎卜誤

#1 Created at ... [Delete] [Delete and Lock User]
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


  • 1

Reply