3.x 中是否有使用 http.client.HTTPMessage().get_content_type() 的函数?
最佳答案
urllib2.urlopen()
返回带有 headers
的 addinfourl
:
>>> import urllib2
>>> f = urllib2.urlopen('http://www.python.org/')
>>> f.headers['content-type']
'text/html'
>>>
关于python - 如何从 python2.x 中的 urlopen(url) 返回获取内容类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2267568/