re.findall(pattern, string, flags=0)
Return all non-overlapping matches of pattern in string, as a list of strings. The string is scanned left-to-right, and matches are returned in the order found. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result unless they touch the beginning of another match.
re.findall(r"a((\d+)e?)(w+)b", "a2356ewwwwb")
输出: [(‘2356e’, ‘2356’, ‘wwww’)]
版权声明:本文为iamzhangzhuping原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。