成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁技術(shù)文章
文章詳情頁

Python正則表達(dá)式提取字符串部分內(nèi)容

瀏覽:88日期:2022-06-28 18:11:07

問題描述

樣本:user<user@test.com>如何提取其中的 user@test.com 部分?

問一下,用Python 正則如何最優(yōu)實(shí)現(xiàn)?

問題解答

回答1:

import restr = ’user<user@test.com>’print re.search(’<(.+)>’, str).group(1)回答2:

# coding: utf8import restring = ’user<user@test.com>’print re.findall(r’<([^>]+)’, string)

標(biāo)簽: Python 編程
相關(guān)文章: