2024-04-19 05:02:01 发布
网友
这是我的代码:
import re pattern_str = '(?P<style>[^|]*>)\|(?P<tags>[^|]*)' p = re.compile(pattern_str) m = p.match('OL|AAAAA') a = m.group('style') # AttributeError: 'NoneType' object has no attribute 'group' print a
不管用,怎么修?在
我的python版本是2.6.5
在style模式中有一个额外的>:
style
>
pattern_str = '(?P<style>[^|]*)\|(?P<tags>[^|]*)'
在
style
模式中有一个额外的>
:相关问题 更多 >
编程相关推荐