V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  xlzd  ›  全部回复第 1 页 / 共 1 页
回复总数  2
2016-11-07 18:03:16 +08:00
回复了 allencode 创建的主题 知乎 一个看知乎**妹子**的 Google Chrome App,简单易用,好玩
@allencode 看到你在 GitHub 的仓库啦,其实关键词可以考虑从服务器下发,不要写死在代码中。
2016-04-11 14:13:06 +08:00
回复了 omg21 创建的主题 Python 用 BeautifulSoup4 怎样取出全部链接的 text ?
list_a, list_a_text = (lambda l: ([_['href'] for _ in l], [_.getText() for _ in l]))(getattr(__import__('bs4'), 'BeautifulSoup')(open('tmp1.txt'), 'lxml').find_all('a'))

上面的代码即可取出 tmp1.txt 中的所有链接放到 list_a 中,并将链接中的文本放到 list_a_text 中。
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1319 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 17:30 · PVG 01:30 · LAX 10:30 · JFK 13:30
Developed with CodeLauncher
♥ Do have faith in what you're doing.