我的网站,如http://site.com
如何查找并从网页中提取链接?
我想取主页,只提取匹配的正则表达式的链接,例如.*somepage.*
的HTML代码链接的格式可以是:
<a href="http://site.com/my-somepage">url</a>
<a href="/my-somepage.html">url</a>
<a href="my-somepage.htm">url</a>
我需要输出格式:
http://site.com/my-somepage
http://site.com/my-somepage.html
http://site.com/my-somepage.htm
输出url必须包含域名总是。
什么是快速Python解决方案?
那你试试,没有工作? StackOverflow不是一种代码编写服务,但如果您首先解决问题,我们会为您提供帮助。 – 2013-03-19 04:15:54
查看一个HTML解析模块,比如BeautifulSoup。 (会发布一个链接,但我在我的手机上,对不起) – TerryA 2013-03-19 04:24:20