【发布时间】:2013-07-21 20:38:46
【问题描述】:
我正在使用 Python 的“re”模块如下:
request = get("http://www.allmusic.com/album/warning-mw0000106792")
print re.findall('<hgroup>(.*?)</hgroup>', request)
我所做的只是获取this site 的 HTML,并寻找这段特殊的 sn-p 代码:
<hgroup>
<h3 class="album-artist">
<a href="http://www.allmusic.com/artist/green-day-mn0000154544">Green Day</a> </h3>
<h2 class="album-title">
Warning </h2>
</hgroup>
但是,它继续打印一个空数组。为什么是这样?为什么re.findall 找不到这个sn-p?
【问题讨论】:
-
<hgroup><hgroup></hgroup></hgroup>怎么样?那应该匹配什么?