V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2015-10-25 21:00:56 +08:00 · 1880 次点击
    这是一个创建于 3121 天前的主题,其中的信息可能已经有所发展或是发生改变。
    目的是爬取 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  
       2015-10-25 23:09:56 +08:00
    试试 BeautifulSoup 吧
    master13
        2
    master13  
       2015-10-27 09:14:31 +08:00
    并没有看懂问题……
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2745 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 04:05 · PVG 12:05 · LAX 21:05 · JFK 00:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.