ʹÓÃpython»ñÈ¡htmlÒ³ÃæµÄÄÚÈÝ
import urllib
from HTMLParser import HTMLParser
class TitleParser(HTMLParser):
def __init__(self):
self.title = ''
self.divcontent = ''
self.readingtitle = 0
self.readingdiv = 0
HTMLParser.__init__(self)
def handle_starttag(self, tag, attrs):
if tag == 'title':
self.readingtitle = 1
if -1 != tag.find("div"):
self.readingdiv = 1
def handle_data(self, data):
if self.readingtitle:
# Ordinarily, this is slow and a bad practice, but
# we can get away with it because a title is usually
# small and simple.
self.title += data
if self.readingdiv:
self.divcontent += data
def handle_endtag(self, tag):
if tag == 'title':
self.readingtitle = 0
if tag == "div":
self.readingdiv = 0
def gettitle(self):
return self.title
def getdiv(self):
return self.divcontent
def getweb(url):
web = urllib.urlopen('http://blog.chinaunix.net/u3/105068/showart_2223566.html').read()
return web
web = getweb('http://blog.chinaunix.net/u3/105068/showart_2223566.html')
test = TitleParser()
test.feed(web)
file_object = open('abinfile', 'w')
file_object.write(test.title)
file_object.write("\r\n")
file_object.write(test.divcontent)
file_object.close()
Ïà¹ØÎĵµ£º
±ê׼ʼþÊôÐÔ
HTML 4 Ôö¼ÓÁËͨ¹ýʼþ´¥·¢ä¯ÀÀÆ÷ÖÐÐÐΪµÄÄÜÁ¦£¬±ÈÈçµ±Óû§µã»÷ij¸öÔªËØʱÆô¶¯Ò»¶Î JavaScript¡£
Èç¹ûÐèҪѧϰ¸ü¶àÓйØʹÓÃÕâЩʼþ½øÐбà³ÌµÄÄÚÈÝ£¬ÇëѧϰÎÒÃÇµÄ JavaScript ½Ì³Ì ºÍ DHTML ½Ì³Ì¡£
ÏÂÃæµÄ±í¸ñÁгöÁ˿ɲåÈë HTML 5 ÔªËØÖÐÒÔ¶¨ÒåʼþÐÐΪµÄ±ê׼ʼþÊôÐÔ¡£
HTML 4.01 Óë HTML 5 Ö®¼äµÄ²îÒì ......
<script language="javascript">
var o = document.body;
//´´½¨±í¸ñ
function createTable(w,h,r,c)
{
var table = document.createElement("table");
var tbody = document.createElement("tbody");
table.width = w;
table.height = h;
table.border = 1;
for(var i=1;i<=r; ......
1 ËùÓÐµÄ .java|.jsp|.html|.xml Ô´Îļþ¾ùʹÓÃutf-8±àÂë¸ñʽ±£´æµ½ÏµÍ³´ÅÅÌ¡£
È磺ÔÚEclipseÖбà¼Îļþ£¬Ñ¡ÖÐÎļþ´ò¿ªÓÒ¼ü²Ëµ¥Ñ¡ÔñÊôÐÔ£¬½«Îı¾Îļþ±àÂëÉèÖÃΪÆäËû²¢Ñ¡ÔñUTF-8£»Ò²¿ÉÒÔÔÚ
Eclipse——Ê×Ñ¡Ïî——³£¹æ——ÄÚÈÝÀàÐÍÖÐÉèÖø÷ÖÖÎļþµÄȱʡ±àÂ룬ÕâÑùÒÔºóËùÓеÄÎı¾Îļþ¶¼Ê¹ÓÃÍ³Ò ......
ʹÓà VAlign ÊôÐÔÖ¸¶¨ÓÉ HtmlTableCell ÀàµÄʵÀýËù±íʾµÄµ¥Ôª¸ñÄÚÈݵĴ¹Ö±¶ÔÆ뷽ʽ
“VALIGN"Òâ˼ -- vertical alignment ´¹Ïò¶ÔÆë·½·¨
ÆäÖµ¿ÉÒÔÊÇtop -- ¶¥²¿£»»òmiddle -- Öв¿£»»òbottom-- µ×²¿£»»òbaseline -- »ùÏß¡£Ä¬ÈÏÖв¿--middle¡£
¶ÔÆ룬¾ÍÊDZí¸ñ£¨Cell)ÄڵĶ«Î÷£¨ÔªËØ°üÀ¨Í¼ÐΣ©ÅŵÃÕûÆë»®Ò»£¬V ......
ÄãÕæµÄÖªµÀÒ»¸öHTML¼°×ÊÔ´ÊÇÈçºÎloadµÄÂð(Á˽â¸÷¸ö²¿·ÖÊǺÎʱÏÂÔغÍÖ´ÐеÄ)
ÔÎĵØÖ·£ºhttp://www.cnblogs.com/mindsbook/archive/2009/12/03/sequence_of_response.html
±¾²©¿ÍËùÓÐÄÚÈݲÉÓà Creative Commons Licenses Ðí¿ÉʹÓÃ. ÒýÓñ¾ÄÚÈÝʱ£¬Çë±£Áô ÖìÌÎ, ³ö´¦ £¬²¢ÇÒ ·ÇÉÌÒµ& ......