$string ='<p>Jane has: {num1} times <img alt="" src="/ckfinder/userfiles/images/shapes/button4.jpg" style="height:59px; width:60px" /></p>
<p>Her Father gives her: {num2} times <img alt="" src="/ckfinder/userfiles/images/shapes/button4.jpg" style="height:59px; width:60px" /></p>
<p> </p>
<p>Total No of Buttons She Have: ans</p>
<p> </p>
<p> </p>
';
在这个字符串中,我想要提取这两行:
另外,我需要提取不会加工两个字符串的字符串。
答案 0 :(得分:0)
试试这个。它在python中完美运行:)
re.findall(r'[\w :]+[\{][a-z]{3}[0-9]*[\}][\w ]*',st)