Re: [問題] 抓取網頁字串

看板Perl作者 (蜥蜴)時間17年前 (2007/05/13 14:55), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
use LWP::Simple; my @M = split(/\n/,get 'http://www.cwb.gov.tw/V5/forecast/taiwan/week.htm' ); foreach (@M) { next if (!/^<t/); print "\n" if (/^<tr/ || /^<table/); print "\t" if (/<\/th>/); print "\t\t$1" if (/title="(.*)">.*<\/td>/); s/<[^>]*>//g; s/\(.*\)//g; print; } #你要的資訊都拿出來了,只是排版怪怪的 #你自己再去增減\t吧 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.120.15.17
文章代碼(AID): #16HhPEja (Perl)
文章代碼(AID): #16HhPEja (Perl)