課程
/后端開發
/Python
/python正則表達式
2016-06-13
源自:python正則表達式 3-3
正在回答
ma?=?re.match(r'<([\w]+>)\1','<book>book>') print?ma.groups() print?ma.group()
\1 ?--> ?([\w]+>) ?--> book> ? ?
你是K大寫啊, 當然不匹配,所以是NoneType啊
ma = re.match(r'<([\w]+>)\1','<book>booK>',re.I)
the second 'booK' has a capital letter 'K', change 'K' to 'k'
舉報
如何使用正則處理文本,帶你對python正則有個全面了解
2 回答請問為什么會出現urllib2.HTTPError: HTTP Error 400: Bad Request錯誤?
1 回答請問出現這個錯誤是Python3的re模塊改了么?
3 回答為什么\Z就匹配出錯了?
3 回答大神們,幫看下在python3.6上運行出現這個錯誤幫解決下,謝謝了
2 回答str1='num1'='100'出現SyntaxError: can't assign to literal錯誤怎么解決
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-10-13
\1 ?--> ?([\w]+>) ?--> book> ? ?
你是K大寫啊, 當然不匹配,所以是NoneType啊
2016-06-14
ma = re.match(r'<([\w]+>)\1','<book>booK>',re.I)
the second 'booK' has a capital letter 'K', change 'K' to 'k'