文章詳情頁
Python正則表達式提取字符串部分內容
瀏覽:62日期:2022-06-28 18:11:07
問題描述
樣本:user<[email protected]>如何提取其中的 [email protected] 部分?
問一下,用Python 正則如何最優實現?
問題解答
回答1:import restr = ’user<[email protected]>’print re.search(’<(.+)>’, str).group(1)回答2:
# coding: utf8import restring = ’user<[email protected]>’print re.findall(r’<([^>]+)’, string)
相關文章:
1. docker不顯示端口映射呢?2. angular.js - 關于$apply()3. 關docker hub上有些鏡像的tag被標記““This image has vulnerabilities””4. macos - mac下docker如何設置代理5. MySQL數據庫中文亂碼的原因6. docker - 各位電腦上有多少個容器啊?容器一多,自己都搞混了,咋辦呢?7. docker gitlab 如何git clone?8. mysql - 新浪微博中的關注功能是如何設計表結構的?9. css - C#與java開發Windows程序哪個好?10. docker-compose 為何找不到配置文件?
排行榜
