我有這樣的:的Python:找到<title>
response = urllib2.urlopen(url)
html = response.read()
begin = html.find('<title>')
end = html.find('</title>',begin)
title = html[begin+len('<title>'):end].strip()
如果URL = http://www.google.com那麼標題都沒有問題, 「谷歌」,
但如果URL = 「http://www.britishcouncil.org/learning-english-gateway」 那麼標題成爲
"<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<base href="http://www.britishcouncil.org/" />
<META http-equiv="Content-Type" Content="text/html;charset=utf-8">
<meta name="WT.sp" content="Learning;Home Page Smart View" />
<meta name="WT.cg_n" content="Learn English Gateway" />
<META NAME="DCS.dcsuri" CONTENT="/learning-english-gateway.htm">..."
究竟發生了什麼,爲什麼我不能返回「標題」?