先说效果:AVVBCCC 匹配出 VVACCCCCD 匹配出CCCCCD单独实现我都会第一种# -*- coding: utf-8 -*-import re#str = 'AVVBCCC'forword = re.search(r'A(.*)B', str).group(1)
print(forword)第二种# -*- coding: utf-8 -*-import re#str = 'ACCCCCD'forword = re.search(r'A(.*)', str).group(1)
print(forword)请问怎么合起来写?
添加回答
举报
0/150
提交
取消