Python3(尖叫)-<bound method HTTPResponse.read of <http.client.HTTPResponse object at 0x03281BD0>>

Python3(Urllib) -<bound method HTTPResponse.read of <http.client.HTTPResponse object at 0x03281BD0>>

import urllib.request

html = urllib.request.urlopen('http://jshawl.com/python-playground/')
s = html.read
print(s)

这是我得到的错误:

<bound method HTTPResponse.read of <http.client.HTTPResponse object at 0x032B18D0>>

如何修复此错误?我犯了什么错误?

您看到的打印内容不是错误 - 您看到的是 HTTPResponse 实例方法字符串表示形式。要获得什么方法 returns,您应该 调用它:

s = html.read()