Skip to content

Commit 467266a

Browse files
authored
练习正则表达式
1 parent 2f99191 commit 467266a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test37.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
4+
'练习正则表达式'
5+
6+
__author__ = 'sergiojune'
7+
import re
8+
9+
10+
# 作业:尝试写一个验证Email地址的正则表达式。版本一应该可以验证出类似的Email
11+
12+
13+
# 匹配邮箱的正则表达式,返回一个正则对象
14+
re_mail = re.compile('[\.\w]*@[\w]+.[\w]+')
15+
m = re_mail.match(a)
16+
print(m.group())
17+
g = re_mail.match(b)
18+
print(g.group())
19+

0 commit comments

Comments
 (0)