Discuss / Python / 打卡

打卡

Topic source

练习1:

# -*- coding: utf-8 -*-
import re

def is_valid_email(addr):

    return re.match(r'^\w+\.?\w+\@\w+\.\w+$', addr)

练习2:

# -*- coding: utf-8 -*-
import re

def name_of_email(addr):

    return  re.match(r'^\<?(\w+\s*\w+)\>?\s*\w*\@\w+\.\w+$', addr).group(1)


  • 1

Reply