python 正则表达式findall函数查找网页中所有的URL
高洛峰
高洛峰 2016-11-11 13:13:25
0
2
913

在做 python practice book 的习题,完成如下问题:
Problem 8: Write a program links.py that takes URL of a webpage as argument and prints all the URLs linked from that webpage.
要求使用 python 的 re 模块。

遇到的问题:正则表达式 (src|href)\=\".*?\" 在 re.findall 无法返回数组 以URL 组成的数组,而是返回了['src', 'src', 'href', 'href', 'href', 'href', 'href', 'href', 'href', 'href', 'href', 'src', 'src', 'src', 'href', 'href'...]


高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!