我有一个很大的字符串,我想找到这个字符串中匹配的所有输入序列。在
例如,我想找到所有可能匹配的防守篮板:
Player xy had 10 defensive rebounds only in the 3rd quarter of a match that was a defensive battle between 2 teams that have a defensive rebound rate of over 80% and moreover the average number of rebounds in the defence by player was a staggering 3.5
我想找到所有的粗体字,然后把它们提取出来。在
我设法构建了一个脚本来执行提取,但它只适用于精确匹配。在
我本来想用difflib.SequenceMatcher
但我被卡住了。在
您可以在python中使用regex,并且应该有一个goog模式来提取它们。在
例如:
findall
返回匹配列表如果所有匹配项都是相同的粗体字形式,则可以使用以下命令提取:
^{pr2}$相关问题 更多 >
编程相关推荐