先說效果: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
提交
取消