推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
musec
V2EX  ›  Python

[菜鸟提问] 一个小爬虫的问题!

  •  
  •   musec · Oct 25, 2015 · 2480 views
    This topic created in 3852 days ago, the information mentioned may be changed or developed.
    目的是爬取 360 某站全部用户名!
    我写出了!提取指定 ID 的!怎么循环啊~

    # -*- coding:utf-8 -*-
    import re
    import urllib2
    import urlparse

    url = '25911'
    pj = urlparse.urljoin('http://security.360.cn/User/userInfo/uid/',url)
    page = urllib2.urlopen(pj)
    html = page.read()
    p = re.compile(r'<span\s*class="w100">(.+?)</span>')
    print p.findall(html)
    nerozhu
        1
    nerozhu  
       Oct 25, 2015
    试试 BeautifulSoup 吧
    master13
        2
    master13  
       Oct 27, 2015
    并没有看懂问题……
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3422 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 10:53 · PVG 18:53 · LAX 03:53 · JFK 06:53
    ♥ Do have faith in what you're doing.