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

推荐订阅源

Google DeepMind News
Google DeepMind News
D
Docker
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
月光博客
月光博客
小众软件
小众软件
量子位
V
Visual Studio Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
罗磊的独立博客
博客园 - 叶小钗
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
博客园 - 司徒正美
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - Franky
Hugging Face - Blog
Hugging Face - Blog
GbyAI
GbyAI
C
Check Point 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)

运行

赞赏作者

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