刚开始学python,对爬虫和正则表达式这部分还不是很熟悉。
我现在准备爬取下面这段源码的href和title部分,爬href中的网址后,要在每个网址前面加上"http://www.infoq.com" ,用到的库是urllib2和re.
我现在碰到的问题时,我能够把网址或者title单独爬下来,但是没有办法一起爬下来。同时爬下来后有重复,因为网址和title在下面的源码中出现了两次。我不知道这个正则表达该怎么写才正确。求教各位前辈指点迷津~
href="/cn/presentations/kanban-instantiation"
title="实例化看板">
<div class="movie">
<img src="http://cdn.infoqstatic.com/statics_s2_20150424-0221/resource/presentations/kanban-instantiation/zh/mediumimage/Snip20140804_27.png"/>
<span class="videolength">33:08</span>
</div>
</a>
<h2 class="itemtitle">
<a
href="/cn/presentations/kanban-instantiation"
title="实例化看板">
实例化看板
</a>
明月笑刀无情
慕沐林林
子衿沉夜
相关分类