【问题标题】:python library to fetch content(http text) from the websites?python库从网站获取内容(http文本)?
【发布时间】:2014-05-06 00:54:57
【问题描述】:

我想要来自urllib python 库的等效于urlopen 的东西来从网络上获取数据,

urlopen 似乎无法在 google 或 youtube 等网站上运行,可能是由于标题不正确,

那么我可以使用任何其他基于 python 的内容提取器吗?

【问题讨论】:

    标签: python url python-2.7


    【解决方案1】:

    这是一个使用urllib2 获取网页的示例:

    import urllib2
    response = urllib2.urlopen('http://google.com/')
    html = response.read()
    

    示例取自urllib2 documentation

    【讨论】:

      猜你喜欢
      • 2020-07-24
      • 1970-01-01
      • 2013-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-29
      • 2016-07-06
      • 2013-10-30
      相关资源
      最近更新 更多