作者imce (蜥蜴)
看板perl
标题Re: [问题] 抓取网页字串
时间Sun May 13 14:55:09 2007
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