V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  VTEX9527  ›  全部回复第 4 页 / 共 5 页
回复总数  83
1  2  3  4  5  
2021-03-09 23:42:09 +08:00
回复了 maloneleo88 创建的主题 Python 正则提取又蒙圈了!
@maloneleo88
楼上正则都是没有问题的,主要应该是 re 模块的实现不一样。python 中 re.findall()是匹配分组的,您要字符串中第一个数组。我暂时能想到的是换一个写法。
str_regex = r'\[18(,\d+){9}\]'
list_value = re.finditer(str_regex, input, flags=re.I)
for match in list_value:
first_array_str = match.group()
print(first_array_str)

然后,自行处理 first_array_str
2021-03-09 22:55:51 +08:00
回复了 maloneleo88 创建的主题 Python 正则提取又蒙圈了!
r'\[18(,\d+){9}\],'
挺简洁的,建议增加导航树做内容分类
2021-02-02 11:42:27 +08:00
回复了 Renco 创建的主题 职场话题 程序员的薪资究竟是怎么定义的?
个人薪酬根据跳槽频率决定
2021-01-24 22:04:31 +08:00
回复了 fiveelementgid 创建的主题 数据库 关系型数据库入门的疑问: SQLite 定位是?
单机内嵌?
2020-11-04 09:36:40 +08:00
回复了 NebulaGraph 创建的主题 推广 发版抽奖保平安 | 抽 2 张京东 E 卡
分子+1
1  2  3  4  5  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2263 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 27ms · UTC 03:00 · PVG 11:00 · LAX 20:00 · JFK 23:00
Developed with CodeLauncher
♥ Do have faith in what you're doing.