Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

python minidom дxmlʾÀý

ÒÔÏÂÊÇÒ»¸öͨ¹ýminidomÄ£¿éдÎļþµÄÍêÕûʾÀý£¬ÊÇÔÚ×î½ü×öµÄÏîÄ¿WalleÉÏÃæÓõ½µÄ,Õâ¸öʾÀýµÄÄ¿µÄÊÇÉú³ÉÒ»¸öÈçϵĸñʽµÄxml£¬Îļþ¸ñʽΪÎÞBOM utf-8¡£
Éú³ÉxmlÎļþ¸ñʽ£º
<?xml version="1.0" encoding="utf-8"?> 
<coverages> 
    <coverage> 
        <Type>total</Type> 
        <Name></Name> 
        <TotalLine>58455</TotalLine> 
        <EffectiveLine>16623</EffectiveLine> 
        <CoveredLine>11368</CoveredLine> 
        <CoverRate>68.38717</CoverRate> 
    </coverage> 
    <coverage> 
        <Type>total</Type> 
        <Name>\¹þ¹þ\¹þ¹þ</Name> 
        <TotalLine>123</TotalLine> 
        <EffectiveLine>28</EffectiveLine> 
        <CoveredLine>16</CoveredLine> 
        <CoverRate>57.14286</CoverRate> 
    </coverage> 
</coverages> 
#-*- coding:utf-8 -*-  
import os  
import codecs  
import traceback  
import xml.dom.minidom as minidom  
def covert_to_unicode(msg):  
    '''''½«×ªÈëµÄ±àÂëת»»Îªunicode£¬Ö»½ÓÊÜutf-8ºÍunicode±àÂë''' 
    __re_str = None 
    if isinstance(msg, unicode):  
        __re_str = msg  


Ïà¹ØÎĵµ£º

pythonµ¼³öÓÊÏäÀïµÄÁªÏµÈË£¬Ö§³ÖGmailµÈ

PythonÓïÑÔ
: µ¼³öÓÊÏäÀïµÄÁªÏµÈË£ºÖ§³ÖGmail£¬126£¬ÍøÒ×£¬ËѺü£¬Hotmail£¬ÐÂÀË£¬ÑÅ»¢£¬MSN
#!/usr/bin/env python
#coding=utf-8
from
BeautifulSoup
import
BeautifulSoup
import
os
,
urllib
,
urllib2
,
pdb
import
cookielib
import
httplib
import
csv
,
re
GDATA_URL
=
'/accoun ......

pythonʵÏֵķ­Òë½Å±¾


½ñÌìͻȻÓÐÒ»¸öÏë·¨£¬¾ÍÊÇÏë×Ô¼ºÐ´Ò»¸ö·­Òë½Å±¾¡£¿ÉϧGoogleÌṩµÄAPIÊǹ©ÍøÂçÓ¦Óõġ£¸ÕºÃÔÚ¡¶dive into python¡·ÀïÃæÕâ±¾ÊéÀïÃæ¿´µ½ÈçºÎ´ÓHTMLÎĵµÖÐÌáÈ¡³öÀ´×Ô¼ºÏëÒªµÄÄÚÈÝ£¬ÄÇÕâÑùµÄ»°£¬¿É²»¿ÉÒÔÄ£Äâä¯ÀÀÆ÷À´·¢ËÍÏë·­ÒëµÄ¾ä×Ó£¬È»ºóÔÙ½ÓÊÕ·µ»Ø½á¹ûºóµÄHTMLÔ´Â룬×îºó´ÓÖÐÌáÈ¡³ö·­ÒëµÄ½á¹ûÄØ£¿¡¡¡¡ÆäʵÊÇÐеģ¬ÒòΪÀûÓ ......

python ×Ö·û´®ºÍdatetimeת»»

       ΪÁË´Ó×Ö·û´®ÖÐÌáȡʱ¼ä£¬²¢½øÐбȽϣ¬Òò´ËÓÐÁËÕâ¸öÎÊÌ⣬ÈçºÎ½«×Ö·û´®×ª»»³ÉdatetimeÀàÐÍ
       1.×Ö·û´®ÓëtimeÀàÐ͵Äת»»
>>> import time
>>> timestr = "time2009-12-14"
>>> t = time.strptime(timest ......

xml½âÎö


ÔÚjavaÓ¦Óÿª·¢ÖÐÎÒÃǺÍxml´ò½»µÀµÃ»ú»á̫ƽ·²ÁË£¬Ò»°ãÇé¿öÏÂÎÒ¿´»áÓÃJDOM»òÊÇDOM4jÀ´½âÎöÎÒÃǵÃXMLÎļþ£¬ÏÂÃæÊÇÒ»¸öDom4j½âÎöxmlÎļþµÃÀý×Ó£¬ÆäÖаüÀ¨Á˶ÔxmlÎļþµÃÈ¡Öµ¡¢¸³Öµ¡¢ÌáÈ¡½Úµã¡¢½ÚµãµÃ±éÀúµÈ¡£
SAXReader reader =
new
SAXReader();   
Document doc = reader.read(...);  &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ