惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Stack Overflow Blog
Stack Overflow Blog
G
Google Developers Blog
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
L
LangChain Blog
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
Y
Y Combinator Blog
月光博客
月光博客
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
小众软件
小众软件
H
Help Net Security
Last Week in AI
Last Week in AI
B
Blog RSS Feed
宝玉的分享
宝玉的分享
N
Netflix TechBlog - Medium
博客园 - 叶小钗
The GitHub Blog
The GitHub Blog

噜啦 - 正则

结合正则表达式爬取网页 - 噜啦 结合正则表达式爬取网页 - 噜啦 正则表达式库函数match与search的区别 - 噜啦 正则表达式库函数match与search的区别 - 噜啦 正则表达式分组功能实例 - 噜啦
正则表达式分组功能实例 - 噜啦
博主: 噜啦 · 2019-10-04 · via 噜啦 - 正则

代码

import re

p = re.compile(r'(\d+)-(\d+)-(\d+)')
print(p.match('2018-05-10').group(2))
print(p.match('2018-05-10').groups())

year, month, day = p.match('2018-05-10').groups()
print(year)

运行

赞赏作者

如果觉得我的文章对你有用,请随意赞赏