Different behavior between re.finditer and re.findall

前端 未结 4 391
逝去的感伤
逝去的感伤 2021-01-31 04:59

I am using the following code:

CARRIS_REGEX=r\'(\\d+)([\\s\\w\\.\\-]+)(\\d+:\\d+)(\\d+m)         


        
4条回答
  •  春和景丽
    2021-01-31 05:52

    re.findall(pattern.string)

    findall() returns all non-overlapping matches of pattern in string as a list of strings.

    re.finditer()

    finditer() returns callable object.

    In both functions, the string is scanned from left to right and matches are returned in order found.

提交回复
热议问题