2014-05-24 126 views
1

提取我有this file解析XML文件,並在蟒蛇

<!DOCTYPE html><html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:Web="http://schemas.live.com/Web/"><head><meta content="text/html; charset=utf-8" http-equiv="content-type" /><script type="text/javascript">//<![CDATA[ 
si_ST=new Date 
//]]></script><script type="text/javascript">//<![CDATA[ 
window.onerror||(window.onerror=function(n,t,i){var r="";r=typeof n=="object"&&n.srcElement&&n.srcElement.src?"\"ScriptSrc = '"+escape(n.srcElement.src.replace(/'/g,""))+"'\"":'"'+escape(n.replace(/"/g,""))+'","Meta":"'+escape(t)+'","Line":'+i,(new Image).src=_G.lsUrl+'&Type=Event.ClientInst&DATA=[{"T":"CI.Error","FID":"CI","Name":"JSError","Text":'+r+"}]",typeof sj_evt!="undefined"&&sj_evt.fire("ErrorInstrumentation",r)});_G={ST:(si_ST?si_ST:new Date),Mkt:"en-WW",RTL:false,Ver:"9_00_0_2878447",IG:"410c25a201f34abf9bb370be85752c1c",EventID:"da89958a1ec345d3a2b4d71cc2c99fbb",V:"web",P:"SERP",DA:"LON04v2",CID:"19621490B4626F483B0F12D4B5436FAF",SUIH:"3btJ3UTMuN9lsHY9kJ936w",PCId:"1",cUrl:"http:\/\/c.bing.com\/c.gif?DI=15074",akamaiSyncUrl:"http:\/\/cms.abmr.net\/pix?cid=1237&amp;uid=",gpUrl:"\/fd\/ls\/GLinkPing.aspx?"};_G.lsUrl="/fd/ls/l?IG="+_G.IG+"&CID="+_G.CID+"&PM=Y";curUrl="http:\/\/www.bing.com\/search";function si_T(a){if(document.images){_G.GPImg=new Image;_G.GPImg.src=_G.gpUrl+'IG='+_G.IG+'&CID='+_G.CID+'&PM=Y'+'&'+a;}return true;}; 
//]]></script><style type="text/css">a{}</style><script type="text/javascript">//<![CDATA[ 
function si_sendCReq(){try{for(var t=0,n=_w;n!=n.parent&&t<10;){if(n.parent.location.hostname==_w.location.hostname)return;n=n.parent,t++}}catch(i){}_G.muidI=new Image,_G.muidI.onload=function(){var r=_d.cookie,t,n,i;return/\bTUID\b/i.test(r)?1:(_G.muidI2=new Image,_G.muidI2.src=_G.gpUrl+"CM=TMF&IG="+_G.IG+(_G.CID?"&CID="+_G.CID:""),t="MUID",n=sj_cook.get(t),n&&(i=n.substring(t.length+1),_G.muidI3=new Image,_G.muidI3.src=_G.akamaiSyncUrl.replace(/&amp;/g,"&")+i),1)},_G.muidI.src=_G.cUrl}; 
//]]></script><title>ip:78.138.105.143 - Bing</title><link href="/search?format=rss&amp;q=ip%3a78.138.105.143&amp;qs=n&amp;pq=ip%3a78.138.105.143&amp;sc=0-0&amp;sp=-1&amp;sk=&amp;first=1&amp;FORM=PERE" rel="alternate" title="XML" type="text/xml"/><link href="/search?format=rss&amp;q=ip%3a78.138.105.143&amp;qs=n&amp;pq=ip%3a78.138.105.143&amp;sc=0-0&amp;sp=-1&amp;sk=&amp;first=1&amp;FORM=PERE" rel="alternate" title="RSS" type="application/rss+xml"/><link href="/s/a/bing_p.ico" rel="icon"/><style type="text/css">img,.cbtn,.sb_meta li,.exp_trwr .sc_rc1,.topBar .bg,.vidr cite.nowrap{vertical-align:bottom}img.img_fav,img.twss,img.twsi,img.sa_iconR{vertical-align:baseline}img.img_msn_icon,td.msn_btn_icon img{vertical-align:text-top}#sb_foot{margin-top:-3px}div.sb_adsWv2 h2.sb_title{display:block}html,body,h1,h3,h4,h5,h6,p,img,ol,ul,li,form,table,tr,th,td{border:0;border-collapse:collapse;border-spacing:0;list-style:none;margin:0;padding:0}input,textarea{font:inherit;font-size:100%}body{min-width:987px}body,.sb_text,.sb_h3{color:#000;font:small/normal Arial,Helvetica,Sans-Serif}a,.sb_link,a.sb_link,.sb_link a,.sb_h3 a{color:#04c;text-decoration:none}a:visited,a.sb_link:visited,.sb_link a:visited,.sb_h3 a:visited{color:#639}a:hover,a.sb_link:hover,.sb_link a:hover,h3 a,.sb_h3 a{text-decoration:underline}h1,h2,h3,h4,h5,h6{font-size:small;font-weight:200}h1{font-size:93%}h2,h3,.sb_h3{font-size:125%}h1,h1 a,h1 a:visited,h2,h2 a,h2 a:visited{color:#000}h2{margin:0 0 .62em}cite,.sb_cite{color:#388222;font-style:normal;word-wrap:break-word}strong{font-weight:700}.sb_title{font-size:91%;margin:0 0 .36em;text-transform:uppercase}.sb_count,.sb_meta,.sb_title,.sb_title a{color:#777}.sb_meta a,.sb_meta a:visited,a.sb_meta,a.sb_meta:visited{color:#36b}.sb_alert{color:#d90026}.sb_alert a{font-style:italic}#sw_hdr,#sw_content,#sw_main,#sw_foot{width:100%;float:left}#sw_content{position:static;z-index:3;min-height:344px}#sw_canvas{padding:0 0 0 15px;clear:both}#sw_main{_display:inline;margin:0 0 0 -15px;padding:0 0 1.54em 15px}.sb_results p,.sb_results .sb_meta{margin:0;line-height:1.2em;word-wrap:break-word}.sp_pss li{display:inline}.sb_pag{width:100%;float:left}.sb_pag li{float:left}.sb_pag h4{display:none}.sb_pag a,.sb_pag span{display:block;padding:.3em .7em;margin:0 .38em 0 0;text-align:center}a.sb_pagP,a.sb_pagN,span.sb_pagSp{padding:.38em .5em}.sb_pag a:hover,a.sb_pagS{text-decoration:none;background:#ededed}a.sb_pagS{color:#000}a.sb_pagP{margin-right:.7em;padding-left:0}a:hover.sb_pagP,a:hover.sb_pagN{text-decoration:underline;background-color:transparent}a.sb_pagP:visited,a.sb_pagN:visited{color:inherit}#sw_aside{width:185px;float:left;margin:0 0 0 -195px;overflow:hidden;word-wrap:break-word}.sw_menu{padding:0 20px}#sw_main .sw_menu{padding:0}.sw_menu form{margin:0;width:100%}.sw_menu ul{padding:0 0 1.52em;margin:0;list-style:none}.sw_menu ul ul{padding:0}.sw_menu li{padding:0 0 .3em}#sb_foot{font-size:83.9%;clear:both;float:left;width:550px;border-top:solid 1px #ccc;margin-left:110px;line-height:23px;_display:inline;_zoom:1}#sw_footL,#sw_footL a,#sw_foot3,#sw_foot3 a{color:#777;clear:both;margin:7px 0 43px 10px}#sw_foot3{margin-top:-43px}#sb_foot ul{display:block}#sb_foot li{display:inline}#sb_foot a,#sb_foot span{margin:.4em}a#sb_feedback{color:#04c}#sw_ctfm{margin:15px 0 0 10px;float:left}.sw_sb,.sw_qbtn,.sw_pifa,.sw_pipp,.sw_pippa,.sw_pil,.sw_pit,.sw_conv,.sw_conva,.sw_poi,.sw_poia{height:20px;width:20px}.sw_pref,.sw_play,.sw_playh,.sw_playa,.sw_playd,.sw_playp,.sw_spp,.sw_spr{height:16px;width:16px}.sw_sb,.sw_qbtn{background:-76px 0}.sw_ddbl,.sw_ddbk,.sw_ddw,.sw_ddgy,.sw_ddgn{background:-404px -22px;height:5px;width:8px;_font-size:0}.sw_ddbk{background:-412px -22px}.sw_ddw{background:-420px -22px}.sw_ddgy{background:-428px -22px}.sw_ddgn{background:-436px -22px}.sw_meIc{background:-108px 0;height:12px;width:10px}#spcv .sw_meIc{background-position:-97px 0}.sw_pref{background:-119px 0}.sw_calc{background:-389px 0;height:19px;width:19px}.sw_pifa{background:-137px 0}.sw_pifa.hover{background-position:-158px 0}.sw_pipp{background:-179px 0}.sw_pipp.hover{background-position:-200px 0}.sw_pippa{background:-221px 0}.sw_pil{background:-242px 0}.sw_pil.hover{background-position:-263px 0}.sw_pit{background:-284px 0}.sw_pit.hover{background-position:-305px 0}.sw_conv{background:-326px 0}.sw_conv:hover{background-position:-347px 0}.sw_conva{background:-368px 0}.sw_poi{background:-409px 0}.sw_poia{background:-430px 0}.sw_play{background:-451px 0}.sw_playh{background:-468px 0}.sw_playa{background:-485px 0}.sw_playd{background:-660px 0}.sw_playp{background:-677px 0}.sw_plus{background:-387px -20px;height:8px;width:8px}.sw_minus{background:-396px -21px;height:2px;width:8px}.sw_st,.sw_sth,.sw_ste,.sw_st2,.sw_sth2{background:-502px 0;height:12px;width:12px}.sw_st2{background:-530px 0}.sw_sth{background:-544px 0}.sw_sth2{background:-558px 0}.sw_ste{background:-516px 0}.sw_tpo,.sw_tpoh,.sw_tpoa{background:-502px -13px;height:12px;width:8px}.sw_tpoh{background:-511px -13px}.sw_tpoa{background:-520px -13px}.sw_tpcg,.sw_tpcbl,.sw_tpcw,.sw_tpcbk{background:-97px -17px;height:9px;width:9px}.sw_tpcbl{background:-107px -17px}.sw_tpcw{background:-117px -17px}.sw_tpcbk{background:-127px -17px}.sw_arw,.sw_arwh{background:-470px -17px;height:11px;width:14px}.sw_arwh{background:-485px -17px}.sw_beak{background:-451px -17px;height:11px;width:18px}.sw_tbcsp:hover{background-position:-126px -17px}.sw_spo,.sw_spc{background:-572px 0;height:28px;width:28px}.sw_spd{background:-601px 0;height:24px;width:24px}.sw_spp{background:-626px 0}.sw_spr{background:-643px 0}.sw_sb,.sw_qbtn,.sw_ddbl,.sw_ddbk,.sw_ddw,.sw_ddgy,.sw_ddgn,.sw_meIc,.sw_pref,.sw_logo,.sw_calc,.sw_pifa,.sw_pipp,.sw_pippa,.sw_pil,.sw_pit,.sw_conv,.sw_conva,.sw_poi,.sw_poia,.sw_play,.sw_playh,.sw_playa,.sw_playd,.sw_playp,.sw_st,.sw_sth,.sw_ste,.sw_st2,.sw_sth2,.sw_plus,.sw_minus,.sw_tpo,.sw_tpoh,.sw_tpoa,.sw_tpcg,.sw_tpcbl,.sw_tpcw,.sw_tpcbk,.sw_arw,.sw_arwh,.sw_beak,.sw_spo,.sw_spc,.sw_spd,.sw_spp,.sw_spr{background-image:url(/fd/s/a/sw17.png);background-repeat:no-repeat}.sw_logo{height:26px;width:75px;background-color:transparent}.idh{padding:0;margin:0;z-index:951}.idd{display:none;z-index:950;position:absolute;width:230px;right:5px}.img_uparrow{margin-left:16px;z-index:952;display:none}#id_t{white-space:nowrap;max-width:150px;overflow:visible}#id_la{cursor:pointer}.idh a:hover{text-decoration:none}.idh .lt{cursor:pointer;height:34px}.pic{vertical-align:middle;margin-left:10px}.pic.si{height:28px;width:28px}.idh .lt #id_t{display:block}.idh .lt #id_s,#id_n{padding-left:8px}.idh .lt #id_r{width:74px;height:13px;position:relative}.idh .lt #id_rc{line-height:13px;position:absolute;top:1px;left:21px}.idh .pref{position:absolute;right:15px;top:48px;cursor:pointer}.img_downarrow{margin-left:4px;vertical-align:middle;display:inline-block}div#sw_canvas{padding-left:120px}.sw_a{position:absolute;top:17px;left:122px;font-weight:700;font-size:84%;z-index:1001;text-transform:uppercase;white-space:nowrap}.sw_a li{display:inline;margin:0 1.8em 0 0;zoom:1}.sw_a a{color:#777;font-weight:700}.sw_aa a{color:#000}.sw_a2{margin:10px 0 20px 110px;padding:0;font-weight:700;font-size:85%;z-index:1001;text-transform:uppercase}.sw_a2 li{display:inline;padding:8px 10px;background:#f5f5f5}.sw_a2 a{color:#777}.sw_a2 .sw_aa{background:#e5e5e5}.sw_a3 .sw_aa{background:#fff}.sw_a3 li{background:#fff;text-transform:none;font-weight:200;font-size:115%}.sw_hdr_img,#sw_im{background:#d9d7cf no-repeat}#sw_page #sw_hdr{min-height:0;_height:auto}html{overflow-y:scroll}.sw_spc{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-o-transform:rotate(180deg)}.nosp.idh{position:absolute;width:240px;height:78px;top:5px;display:none;background-color:#fff}.nosp.idd{top:85px}.nosp.idh .lt{margin-top:38px;margin-right:50px;_margin-right:24px;float:right}.nosp.idh span{color:#727272}.nosp.idh .lt .pic{border:1px solid #f2f2f2}.nosp .img_rwds_sml{position:absolute;top:1px;left:8px}#id_lt{height:34px}.nosp .img_uparrow{top:71px;position:absolute}.nosp.idh .pref:hover{background:url('/fd/s/a/identity6.png') no-repeat scroll -93px -1px transparent}#sw_tfbb{height:0}.sw_sb,.sw_qbtn,.sw_pifa,.sw_pipp,.sw_pippa,.sw_pil,.sw_pit,.sw_conv,.sw_conva,.sw_poi,.sw_poia{height:20px;width:20px}.sw_pref,.sw_play,.sw_playh,.sw_playa,.sw_playd,.sw_spp,.sw_spr{height:16px;width:16px}.sw_sb,.sw_qbtn{background:-76px 0}.sw_ddbl,.sw_ddbk,.sw_ddw,.sw_ddgy,.sw_ddgn{background:-404px -22px;height:5px;width:8px;_font-size:0}.sw_ddbk{background:-412px -22px}.sw_ddw{background:-420px -22px}.sw_ddgy{background:-428px -22px}.sw_ddgn{background:-436px -22px}.sw_meIc{background:-108px 0;height:12px;width:10px}#spcv .sw_meIc{background-position:-97px 0}.sw_pref{background:-119px 0}.sw_calc{background:-389px 0;height:19px;width:19px}.sw_pifa{background:-137px 0}.sw_pifa.hover{background-position:-158px 0}.sw_pipp{background:-179px 0}.sw_pipp.hover{background-position:-200px 0}.sw_pippa{background:-221px 0}.sw_pil{background:-242px 0}.sw_pil.hover{background-position:-263px 0}.sw_pit{background:-284px 0}.sw_pit.hover{background-position:-305px 0}.sw_conv{background:-326px 0}.sw_conv:hover{background-position:-347px 0}.sw_conva{background:-368px 0}.sw_poi{background:-409px 0}.sw_poia{background:-430px 0}.sw_play{background:-451px 0}.sw_playh{background:-468px 0}.sw_playa{background:-485px 0}.sw_playd{background:-660px 0}.sw_plus{background:-387px -20px;height:8px;width:8px}.sw_minus{background:-396px -21px;height:2px;width:8px}.sw_st,.sw_sth,.sw_ste,.sw_st2,.sw_sth2{background:-502px 0;height:12px;width:12px}.sw_st2{background:-530px 0}.sw_sth{background:-544px 0}.sw_sth2{background:-558px 0}.sw_ste{background:-516px 0}.sw_tpo,.sw_tpoh,.sw_tpoa{background:-502px -13px;height:12px;width:8px}.sw_tpoh{background:-511px -13px}.sw_tpoa{background:-520px -13px}.sw_tpcg,.sw_tpcbl,.sw_tpcw,.sw_tpcbk{background:-97px -17px;height:9px;width:9px}.sw_tpcbl{background:-107px -17px}.sw_tpcw{background:-117px -17px}.sw_tpcbk{background:-127px -17px}.sw_arw,.sw_arwh{background:-470px -17px;height:11px;width:14px}.sw_arwh{background:-485px -17px}.sw_beak{background:-451px -17px;height:11px;width:18px}.sw_tbcsp:hover{background-position:-126px -17px}.sw_spo,.sw_spc{background:-572px 0;height:28px;width:28px}.sw_spd{background:-601px 0;height:24px;width:24px}.sw_spp{background:-626px 0}.sw_spr{background:-643px 0}.sw_sb,.sw_qbtn,.sw_ddbl,.sw_ddbk,.sw_ddw,.sw_ddgy,.sw_ddgn,.sw_meIc,.sw_pref,.sw_logo,.sw_calc,.sw_pifa,.sw_pipp,.sw_pippa,.sw_pil,.sw_pit,.sw_conv,.sw_conva,.sw_poi,.sw_poia,.sw_play,.sw_playh,.sw_playa,.sw_playd,.sw_st,.sw_sth,.sw_ste,.sw_st2,.sw_sth2,.sw_plus,.sw_minus,.sw_tpo,.sw_tpoh,.sw_tpoa,.sw_tpcg,.sw_tpcbl,.sw_tpcw,.sw_tpcbk,.sw_arw,.sw_arwh,.sw_beak,.sw_spo,.sw_spc,.sw_spd,.sw_spp,.sw_spr{background-image:url(/sa/simg/sw_21_lg.png);background-repeat:no-repeat}.sw_logo{height:29px;width:73px;background-color:transparent;text-indent:-9999px}#sw_hdr .sw_box{padding:36px 0 0}#sw_hdr{min-height:100px;_height:100px;padding:0 0 4px 0;background:#fff}.sw_logo{_display:inline;margin:1px 10px 0 27px;float:left}.sw_logoT{color:#000;font-size:17px;line-height:normal;position:absolute;z-index:-1}#sw_hdr .sw_box{position:relative;z-index:901;float:left}.sw_hdr_img,#sw_im{height:5px;font-size:0;cursor:pointer}.sw_bd{position:relative;float:left;font-size:medium;border:1px #999 solid}.sw_b{float:none;padding:.19em .1em 1.06em .03em;height:13px}.sw_b input{float:left;border:0;-webkit-appearance:none;outline:none;font-family:"Segoe UI",Arial,Helvetica,Sans-Serif}.sw_qbox{margin:0 0 -.88em;padding:.19em .15em .25em .56em;height:22px;line-height:1.25em;width:480px}.sw_b .sw_sb,.sw_b .sw_qbtn{cursor:pointer;padding:0;margin:4px 6px -14px 8px;overflow:hidden;font-size:0}.sw_dvdr{background:#ccc;height:21px;margin:3px 0 -15px 12px;float:left;width:1px}#content .cttl{color:#404040!important}#content,#content a.sb_pagS,#sidebar DIV.sw_menu,#sidebar .ans,div.wpc_module h2,div.wpc_module .sb_h3,div.wpc_module .cbl,#content a.exp_trgr{color:#404040}#content .sb_adW a,#content .sb_adN a{color:#1020b0}#content .sb_adW a:visited,#content .sb_adN a:visited{color:#6010d0}#sidebar DIV.sw_menu a,div.wpc_module a,#content a,a#sb_feedback{color:#1020d0}#sidebar DIV.sw_menu a:visited,div.wpc_module a:visited,#content a:visited{color:#600090}#content cite,#content .sb_cite,#content .sb_meta CITE A{color:#009030}#content .sp_pss,#content .cllc p,#content .nc_os,#content .news_dt,#content .time,#content .sb_adW .sc_rtg,#sidebar .sb_add .sc_rtg,#sidebar .sb_meta,#sidebar .rrrs_ttl,#content a.exp_trgr{color:#606060}#content .sb_adW cite{color:#008030}#content .sb_adW p{color:#303030}#content .wpc_module h2,#content .wpc_module .sb_h3,#content .wpc_module .cbl{color:#000}#content{padding:8px 0 0;margin:0 0 0 -15px;display:inline-block}#results_area{float:left;width:550px}#sw_main{padding-bottom:0}#results_container{padding:0 15px 0 15px}#sidebar{float:left;padding:0 15px 0 26px;word-wrap:break-word}#results:after{clear:both;content:'.';display:block;height:0;visibility:hidden}.sb_ph{margin:20px 0 .93em;padding-bottom:10px;font-size:91%}.sb_ph .sb_count{float:left;text-transform:uppercase;color:#000;padding-right:25px}.sb_ph a{color:#737373;text-decoration:underline;*vertical-align:top}.sb_ph .ftrH{*vertical-align:baseline}#results_area .sb_pag{padding:1.33em 0 0;margin:0 0 40px 0}.sb_results li.sa_wr{padding:0 0 10px}.sa_mc{padding:0 0 10px}.sb_tlst,.sa_mc .sb_meta{word-wrap:break-word;padding:0 0 2px}div.wr_cm2 .sb_meta{padding:0}.sb_meta a,.sb_meta a:visited{color:#36b}.sp_pss{color:#777;line-height:1.2em}.sb_tlst H3,.sb_tlst div{display:inline}#results_removed{margin:0 0 24px}.sb_ans,.sa_wr{_margin-right:-3px;float:left;width:100%}#results{zoom:1}.sf,.sf_wa1{float:left}.sf_wa1{width:9.23em}.sf{width:100%}.sc_m4,.sc_m12{margin:0;clear:both}.sc_m4{margin:.2em .77em 0 0}.sc_m7{margin-top:.3em}.sc_m12{_height:2.4em;max-height:2.5em;*max-height:2.4em;margin-top:.3em}.sc_st div.sc_m4{overflow:hidden;height:1.35em}.sc_st div.sc_m12{overflow:hidden;text-overflow:ellipsis}.sc_f2{line-height:1.33em}.nowrap{white-space:nowrap;display:inline-block}.sn_att,.sn_pn{width:100%;float:left;margin-top:.77em}.sn_att2{width:100%;float:left;margin-top:2px}.sn_att,.sn_gr,sn_pn{clear:both;margin:0}.sn_att a:visited,.sn_att2 a:visited{color:#639}sn_cl{width:100%;float:left}.sn_rc,.sn_lc{width:250px;float:left;word-wrap:break-word}.sn_lc{padding-right:10px}.sn_mm{float:left;margin:0 .77em 0 0}.sn_rct{display:table;line-height:1.33em;zoom:1}.sn_gr{margin-top:.5em}.sc_m4:after,.ans2:after,.sn_gr:after{content:".";display:block;clear:both;height:0;visibility:hidden}.ans2 .sc_hl1 li,.ans3 .sc_hl1 li,.ans2 ul.sc_gpl1 ul.sc_hl1,.ansC h3{display:inline}.ans3 .sc_rc1 img{vertical-align:-1px}.ans2 ul.sc_gpl1{margin-bottom:4px}.ans2 ul.sc_gpl1 h3{_clear:both;_display:inline;a:0}.ans3{max-width:585px;_zoom:1}.ans p,.ans ul{margin:0;padding:0}.ans ul{list-style-type:none}.ans .time,.ans h2{color:#525051}.ans h5{display:inline;margin:0 .5em 0 0}.ans h5{font-weight:400;font-size:100%}.ans2 h2 div span span{white-space:nowrap}#results .ans h2{float:none;width:auto;margin:0 0 .62em}.ans h3{font-weight:bold;color:#000}.ans h3 a{font-weight:normal}.ans h4.sc_ih1{float:left;margin:0 .5em 0 0;font-weight:400}.ans2 h2 div span span a{text-decoration:none}.ans2 h2 div span span a:hover,.ans h2 a{text-decoration:underline}.ans2 h2 span{color:#000}h2 div span a:visited,.ansC h2 a:visited{color:#639}h2 span{font-size:small;margin-left:.47em}.ansC{clear:left}.ans{margin-bottom:20px;*display:inline-block;a:0}.sb_results .sa_wr .ansC .ans{margin-bottom:0}.ans ul.sc_bl2 li:first-child{margin-bottom:.3em}.ansA .ans{background-image:none}.ansA .ans h3{color:#549c00;font-size:150%;font-weight:200}.sb_results .ansC .ans{_left:0}.ttl{display:none}.ansC ul,#results .ansC ul{margin:0}.ans h2 a{color:#04c}.c_tlbxTrg{height:14px;width:15px;display:inline-block;margin:-1px 6px -3px 2px;font-size:0}.c_tlbxH{display:none}.cchi{padding-top:3px}.crch{padding-top:5px}.cfct,.csec{color:#737373}.cttl{color:#000!important;margin:0!important;padding:0 0 2px}p.catr{clear:left;width:100%;padding:1px 0 2px 0}.catr cite{*float:left}.cchi{clear:left}.ansC{clear:left}.ans{margin-bottom:20px;*display:inline-block;a:0}.ans2:after{content:".";display:block;clear:both;height:0;visibility:hidden}.ans h2 a{color:#04c;text-decoration:underline}.ans h2 a:visited{color:#639}.ans h2{color:#525051}</style><style type="text/css">.sw_hdr_img,#sw_im{background:#025285 no-repeat}</style><script type="text/javascript">//<![CDATA[ 
var amd,define,require;(function(n){function e(n,i,u){t[n]||(t[n]={dependencies:i,callback:u},r(n))}function r(){if(arguments.length==0){if(!f){for(var n in t)u(n);f=!0}return i}if(arguments.length==1)return u(arguments[0])}function u(n){var s,e;if(i[n])return i[n];if(t.hasOwnProperty(n)){var h=t[n],f=h.dependencies,l=h.callback,a=r,o={},c=[a,o];if(f.length<2)throw error("invalid usage");else if(f.length>2)for(s=f.slice(2,f.length),e=0;e<s.length;e++)c.push(u(s[e]));return l.apply(this,c),i[n]=o,o}}var t={},i={},f=!1;n.define=e,n.require=r})(amd||(amd={})),define=amd.define,require=amd.require;var _w=window,_d=document,sb_ie=window.ActiveXObject!==undefined,sb_i6=sb_ie&&!_w.XMLHttpRequest,_ge=function(n){return _d.getElementById(n)},sb_st=function(n,t){return setTimeout(n,t)},sb_ct=function(n){clearTimeout(n)},sb_gt=function(){return+new Date},sj_gx=function(){return sb_i6?new ActiveXObject("MSXML2.XMLHTTP"):new XMLHttpRequest};_w.sj_ce=function(n){return _d.createElement(n)},_w.sk_merge||(_w.sk_merge=function(n){_d.cookie=n});define("fallback",["require","exports"],function(n,t){function f(){return function(){for(var t=[],i,n=0;n<arguments.length-0;n++)t[n]=arguments[n+0];i=e(arguments.callee),t[0]==="onPP"&&o(),i.push(t)}}function e(n){for(var t in i)if(i[t].h===n)return i[t].q}function u(n,t){for(var e=n.split("."),i=_w,u,r=0;r<e.length;r++)u=e[r],typeof i[u]=="undefined"&&t&&(i[u]=r===e.length-1?f():{}),i=i[u];return i}function o(){var e=i["rms.js"].q,o,f,t,n,r,u;if(e.length>0)for(o=!1,f=0;f<e.length;f++){for(t=e[f],n=0;n<t.length;n++)if(r=t[n]["A:Shared.Bundle"],r||(r=t[n]["A:rmsBu0"]),r){u=_d.createElement("script"),u.setAttribute("data-rms","1"),u.src=r,u.type="text/javascript",setTimeout(function(){_d.body.appendChild(u)},0),t.splice(n,1),o=!0;break}if(o)break}}function s(){for(var t,f,n=0;n<r.length;n++)t=r[n],f=u(t,!0),i[t]={h:f,q:[]}}function h(){for(var t,n=0;n<r.length;n++){var f=r[n],e=i[f].q,o=u(f);for(t=0;t<e.length;t++)o.apply(null,e[t])}}function c(n,t,i,r){(n===_w||n===_d||n===_d.body)&&t=="load"?_w.sj_evt.bind("onP1",i,!0):n.addEventListener?n.addEventListener(t,i,r):n.attachEvent?n.attachEvent("on"+t,i):n["on"+t]=i}var r=["rms.js","sj_evt.bind","sj_evt.fire","sj_jb","sj_wf","sj_cook.get","sj_cook.set","sj_pd","sj_sp","sj_be","sj_go","sj_ue","sj_evt.unbind","sj_et","Log.Log"],i={};t.replay=h,s(),_w.sj_be=c});function lb(){_w.si_sendCReq&&sb_st(_w.si_sendCReq,800),_w.lbc&&_w.lbc()};var si_PP=function(n,t){var i,u,f,e,o,h,c,r,l,s;if(!_G.PPS){for(u=["FC","BC","H","BP",null];i=u.shift();)u.push('"'+i+'":'+(_G[i+"T"]?_G[i+"T"]-_G.ST:-1));if(f=_w.performance&&_w.performance.timing,e=null,f&&(o=["unloadEventStart","unloadEventEnd","redirectStart","redirectEnd","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","secureConnectionStart","requestStart","responseStart","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd","msFirstPaint","responseEnd",""],h=f.navigationStart,h>=0)){for(l=s=c=0;i=o.shift();c++)r=f[i],r>0&&(l|=1<<c,r-=h,o.push(r===s?"":(r-s).toString(16)),s=r);e=',"w3c":"'+l.toString(16)+","+o.join()+'"'}_G.PPImg=new Image,_G.PPImg.src=_G.lsUrl+'&Type=Event.CPT&DATA={"pp":{"S":"'+(t||"L")+'",'+u.join(",")+',"CT":'+(n-_G.ST)+',"IL":'+_d.images.length+"}"+(_G.C1?","+_G.C1:"")+(e!==null?e:"")+"}"+(_G.P?"&P="+_G.P:"")+(_G.DA?"&DA="+_G.DA:"")+(_G.MN?"&MN="+_G.MN:""),_G.PPS=1,sb_st(function(){sj_evt.fire("onPP")},1)}};_w.onbeforeunload=function(){si_PP(new Date,"A")};function si_ct(n,t){var i="getAttribute",r,u,f;try{for(;n!==document.body;n=n.parentNode){if(r=n.tagName=="A"&&n[i]("h")||n[i]("_ct"),r){u=n[i]("_ctf")||"si_T",_w[u]&&_w[u]("&"+r);break}if(t)break}}catch(e){}return!0}(function(){sj_be(document,"mousedown",function(n){si_ct(sb_ie?event.srcElement:n.target)},!1)})();var wlc_d = 1500,wlc_t = 63536526142;;(function(n){var i,r,t;if(document.querySelector){i=[],r="ad";function u(){var c=sb_gt(),u=document.documentElement,r=document.body,f=-1,e=-1,o=u.clientHeight,s=["#b_results .b_ad",".sb_adsWv2",".ads"],t,h,n;if(r){for(t=0;t<s.length;t++)if(h=s[t],n=document.querySelector(h),n&&n.offsetTop<o){f=n.offsetHeight,e=n.offsetTop;break}i=[e,f,u.clientWidth,o,r.offsetWidth,r.offsetHeight,sb_gt()-c]}}n?(t=n.onbeforefire,n.onbeforefire=function(){t&&t(),u(),n.mark(r,i)}):(t=si_PP,si_PP=function(){u();var n='"'+r+'":['+i.join()+"]";_G.C1=_G.C1?_G.C1+","+n:n,t.apply(null,[].slice.apply(arguments))})}})(_w.pp);var sj_log=function(n,t,i){var r=new RegExp('"',"g");(new Image).src=_G.lsUrl+'&Type=Event.ClientInst&DATA=[{"T":"'+n+'","FID":"CI","Name":"'+t+'","Text":"'+escape(i.replace(r,""))+'"}]'};_w.AM=["live.com","virtualearth.net","windows.net","onenote.com","hexun.com","dict.bing.com.cn","msn.com","variflight.com","bing.net"];(function(){function f(t,r){var u=t.tagName;return(u==="SCRIPT"&&(n.href=t.src)||u==="OBJECT"&&t.type&&t.type.indexOf("flash")>0&&(n.href=t.data))&&n.href.length>0&&n.hostname.length>0&&n.hostname!==location.hostname&&!e(n.hostname)?(sj_log("CI.AntiMalware",r,u.substr(0,1)+":"+n.href.substr(0,i)),!1):!0}function e(n){for(var i=0;i<t.length;i++)if(n.indexOf(t[i])>=0)return!0;return!1}var t=_w.AM,i=100,n=document.createElement("A"),r,u;document.write=function(n){n.length>0&&sj_log("CI.AntiMalware","DW",n.substr(0,i))},typeof Element!="undefined"&&Element.prototype&&(r=Element.prototype.appendChild,Element.prototype.appendChild=function(n){return f(n,"AC")?r.apply(this,arguments):null},u=Element.prototype.insertBefore,Element.prototype.insertBefore=function(n){return f(n,"IB")?u.apply(this,arguments):null})})(); 
//]]></script><!-- FD: 3199A45BC1782ABCC0516DD723814485 --></head><body class=" en en-ww" onload="if(_w.lb)lb();"><script type="text/javascript">//<![CDATA[ 
_G.PCT=new Date 
//]]></script><!--FdBodyAsync--><div id="sw_page"><div id="sw_width"><div class="sw_hdr_bg" id="sw_hdr"><div class="idh nosp" id="id_h"><table class="lt" id="id_l" _ct="ID=PJ,1.1"><tr id="id_lt"><td><img id="id_p" class="pic si" style="display:none" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAIBTAA7" title=""/></td><td><a href="javascript:void(0);" id="id_la"><div id="id_t"><span id="id_n" style="display:none"></span><span id="id_s">Sign in</span><span id="id_a" class="img_downarrow sw_ddb sw_ddgy">&nbsp;&nbsp;</span></div></a></td></tr><tr><td colspan="2"><div class="img_uparrow sw_beak" id="id_d_u"></div></td></tr></table><a href="/account/general?ru=http%3a%2f%2fwww.bing.com%2fsearch%3fq%3dip%3a78.138.105.143%26qs%3dn%26pq%3dip%3a78.138.105.143%26sc%3d0-0%26sp%3d-1%26sk%3d%26first%3d1%26FORM%3dPERE&amp;FORM=SEFD" class="pref sw_pref" title="Preferences" _ct="ID=PJ,2.1"></a></div><div id="sw_tfbb"></div><span class="idd nosp" id="id_d" _iid="PJ.5"></span><a href="/?FORM=HDRHME" title="Explore today’s homepage" h="ID=SERP,5030.1"><div class="sw_hdr_img"><div id="sw_im"></div></div></a><form action="/search" id="sb_form" class="sw_box" ><a href="/?FORM=Z9FD1" class="sw_logo" h="ID=SERP,5028.1"><span class="sw_logoT">Bing</span></a><div class="sw_bd"><div class="sw_b" id="sw_b"><input class="sw_qbox" id="sb_form_q" name="q" title="Enter your search term" type="text" value="ip:78.138.105.143" onfocus="document.getElementById('sw_b').style.borderColor='#3366bb';" onblur="document.getElementById('sw_b').style.borderColor = '#999';" maxlength="1000"/><div class="sw_dvdr"></div><input id="sb_form_go" class="sw_qbtn" title="Search" tabIndex="0" name="go" type="submit" value=""/></div><input id="sa_qs" name="qs" value="ds" type="hidden"/></div><input type="hidden" value="QBRE" name="form"/></form></div><div id="sw_content"><div></div><script type="text/javascript">//<![CDATA[ 
_G.AppVer="8_01_1_2887305"; 
//]]></script><!--snr2--><!--wm--><script type="text/javascript">//<![CDATA[ 
_G.FCT=new Date 
//]]></script><script type="text/javascript">//<![CDATA[ 
_G.BCT=new Date 
//]]></script><style type="text/css">div#sw_canvas{padding-left:120px}#sw_hdr{min-height:0;_height:auto}</style><style type="text/css">#sidebar{width:245px}.sw_a{position:absolute;top:17px;left:122px;font-weight:700;font-size:84%;z-index:1001;text-transform:uppercase;white-space:nowrap}.sw_a li{display:inline;margin:0 1.8em 0 0;zoom:1}.sw_a a{color:#777;font-weight:700}.sw_aa a{color:#000}.sw_a2{margin:10px 0 20px 110px;padding:0;font-weight:700;font-size:85%;z-index:1001;text-transform:uppercase}.sw_a2 li{display:inline;padding:8px 10px;background:#f5f5f5}.sw_a2 a{color:#777}.sw_a2 .sw_aa{background:#e5e5e5}.sw_a3 .sw_aa{background:#fff}.sw_a3 li{background:#fff;text-transform:none;font-weight:200;font-size:115%}</style><div><div id="sw_canvas"><div id="sw_main"><ul class="sw_a"><li class="sw_aa"><a href="/?scope=web&amp;FORM=HDRSC1" h="ID=SERP,5229.1">Web</a></li><li><a href="/images/search?q=ip%3a78.138.105.143&amp;FORM=HDRSC2" h="ID=SERP,5223.1">Images</a></li><li><a href="/videos/search?q=ip%3a78.138.105.143&amp;FORM=HDRSC3" h="ID=SERP,5224.1">Videos</a></li><li><a href="/news/search?q=ip%3a78.138.105.143&amp;FORM=HDRSC4" h="ID=SERP,5225.1">News</a></li><li><a href="/explore?q=ip%3a78.138.105.143&amp;FORM=HDRSC5" h="ID=SERP,5226.1">More</a></li></ul><div class="sb_ph" id="tw"><span class="sb_count" id="count">10,400 results</span></div><div id="content"><div id="results_area"><div id="results_container"><!-- snr --><div id="results"><ul id="wg0" class="sb_results"><li class="sa_wr"><div class="sa_cc" u="0|5045|4735365968236910|_mzMXEsCeh1pZWgn3ltY1CvygytGJtzt"><div Class="sa_mc"><div class="sb_tlst"><h3><a href="http://taksuncontrol.com/" h="ID=SERP,5069.1">تکسان کنترل</a></h3></div><div class="sb_meta"><cite>taksuncontrol.com</cite><span class="c_tlbxTrg"><span class="c_tlbxH" H="BASE:CACHEDPAGEDEFAULT" K="SERP,5071.1"></span></span></div><p>به وبسایت شرکت تکسان کنترل خوش آمدید! شركت تکسان کنترل فعالیت خود را به عنوان تولید كننده ...</p></div></div></li><li class="sa_wr"><div class="sa_cc" u="1|5046|4743251550085295|CbNAtAlUe9hs-0s5bPT-5-O4OjuxLD9X"><div Class="sa_mc"><div class="sb_tlst"><h3><a href="http://www.royal-jelve.ir/" h="ID=SERP,5082.1">شرکت رویال جلوه جنوب</a></h3></div><div class="sb_meta"><cite>www.royal-jelve.ir</cite> 

我想知道是否有一種方法來分析它,並<cite> and </cite>之間提取所有結果。

回答

3

隨着BeautifulSoup這是簡單的:

​​

對於生成的給定樣品的文件:

>>> import requests 
>>> from bs4 import BeautifulSoup 
>>> r = requests.get('https://raw.githubusercontent.com/MortezaLSC/Puplic/master/file.xml') 
>>> soup = BeautifulSoup(r.content) 
>>> for cite in soup.find_all('cite'): 
...  print cite.string 
... 
taksuncontrol.com 
www.royal-jelve.ir 
+0

如果我有一個文件,而不是URL我應該do'r =開放('/路徑/to/file.xml',r +)'和'soup = BeautifulSoup(r.content)...' – MLSC

+1

@MortezaLSC:如果您有文件,只需將文件對象傳遞給BeautifulSoup。 '打開('/ path/to/file.xml')作爲infh:soup = BeautifulSoup(infh)'。 –

+0

非常感謝... :) – MLSC