【发布时间】:2016-02-23 10:04:51
【问题描述】:
在此 HTML 代码中:
<frameset border="0" framespacing="0" frameborder="0" rows="85,*">
<frame border="0" marginheight="0" name="logoframe" scrolling="no" noresize target="middle" src="a.html" onload="reload()">
<frameset cols="235,*">
<frame border="0" name="left" src="b.html" scrolling="no"><frame border="0" noresize name="main" src="c.html" scrolling="auto"></frameset><noframes>
<body topmargin="0" leftmargin="0">
<p>This page uses frames, but your browser doesn't support them.</p></body>
</noframes>
</frameset></html>
我想找到包含name="main" 的src 属性
在这个例子中它应该返回c.html。
【问题讨论】:
-
不要不使用正则表达式解析 HTML。说真的。
-
beautifulsoup 的解决方案也不错
标签: python html regex beautifulsoup