文章来自《Python cookbook》.

翻译仅仅是为了个人学习,其它商业版权纠纷与此无关!

-- feynman [2004-08-11 00:45:13]

1. 描述

...

1.1. 问题 Problem

你想要从web的一个url抓取html文件

1.2. 解决 Solution

urllib.urlopen 返回 a file-like object,你能调用read()

   1 from urllib import urlopen
   2 
   3 doc = urlopen("http://www.python.org").read(  )
   4 print doc

1.3. 讨论 Discussion