[python] unpack regular expression match results

使用findall()

(unpacked, item1, item2, item3) = re.compile(r'your regular expression').findall(string)[0]

 

来源:https://stackoverflow.com/questions/15340582/python-extract-pattern-matches

posted @ 2025-02-13 12:42  profesor  阅读(9)  评论(0)    收藏  举报