1
3.x使用http.client.HTTPMessage()。get_content_type()函數是否有任何函數?如何從python2.x中的urlopen(url)返回內容類型?
3.x使用http.client.HTTPMessage()。get_content_type()函數是否有任何函數?如何從python2.x中的urlopen(url)返回內容類型?
urllib2.urlopen()
返回addinfourl
與headers
:
>>> import urllib2
>>> f = urllib2.urlopen('http://www.python.org/')
>>> f.headers['content-type']
'text/html'
>>>