|
⇤ ← Revision 1 as of 2004-08-11 00:45:13
Size: 342
Comment:
|
Size: 530
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 15: | Line 15: |
| ... | 你想要从web的一个url抓取html文件 |
| Line 18: | Line 18: |
| ... | urllib.urlopen 返回 a file-like object,你能调用read() |
| Line 21: | Line 21: |
| from urllib import urlopen doc = urlopen("http://www.python.org").read( ) print doc |
文章来自《Python cookbook》. 翻译仅仅是为了个人学习,其它商业版权纠纷与此无关!
-- feynman [DateTime(2004-08-11T00:45:13Z)] TableOfContents
描述
...
问题 Problem
你想要从web的一个url抓取html文件
解决 Solution
urllib.urlopen 返回 a file-like object,你能调用read()
