listing15-3.py
来自「《Beginning Python--From Novice to Profes」· Python 代码 · 共 14 行
PY
14 行
from urllib import urlopenfrom BeautifulSoup import BeautifulSouptext = urlopen('http://python.org/community/jobs').read()soup = BeautifulSoup(text)jobs = set()for header in soup('h3'): links = header('a', 'reference') if not links: continue link = links[0] jobs.add('%s (%s)' % (link.string, link['href']))print '\n'.join(sorted(jobs, key=lambda s: s.lower()))
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?