【发布时间】:2014-06-08 07:42:58
【问题描述】:
我有一个包含样式的链接地址的文本
href=\'http://address.com\'
我在 Python 3.4 中使用 re.findall('"((http)s?://.*?)"', srcCode) 来提取所有链接,但不起作用。我该如何解决?
【问题讨论】:
标签: python regex python-3.x hyperlink html-content-extraction
我有一个包含样式的链接地址的文本
href=\'http://address.com\'
我在 Python 3.4 中使用 re.findall('"((http)s?://.*?)"', srcCode) 来提取所有链接,但不起作用。我该如何解决?
【问题讨论】:
标签: python regex python-3.x hyperlink html-content-extraction
交换引号
re.findall("'((http)s?://.*?)'", srcCode)
【讨论】:
(?:http)
href='http://address.com'但我的文本与样式href=\'http://address.com\'有链接的时候。
re.findall("'((http)s?://.*?).\'", srcCode)
"'((http)s?://.*?).\'" 和 "'((http)s?://.*?).'" 没有任何区别,两者在控制台中的结果相同