gpt4 book ai didi

python - 为什么\b 在 python re 模块中不起作用?

转载 作者:太空狗 更新时间:2023-10-29 19:33:42 25 4
gpt4 key购买 nike

<分区>

众所周知,\b在正则表达式中表示单词边界。但是,python 中 re 模块的以下代码不起作用:

>>> p=re.compile('\baaa\b')
>>> p.findall("aaa vvv")
[]

我觉得findall的返回结果应该是["aaa"],但是什么也没找到。怎么了?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com