不管你是待業(yè)還是失業(yè),在這個(gè)被互聯(lián)網(wǎng)圍繞的時(shí)代里,選擇python爬蟲(chóng)和php爬蟲(chóng),就多了一項技能,還怕找不到工作?,還怕不好找工作?小編就來(lái)告訴你這個(gè)專(zhuān)業(yè)的優(yōu)勢到底體現在哪里:整理java,python,php各自爬蟲(chóng)的寫(xiě)法??。
1.整理java,python,php各自爬蟲(chóng)的寫(xiě)法
最近被面試官問(wèn):會(huì )不會(huì )寫(xiě)爬蟲(chóng)?我覺(jué)得我會(huì )用java,python,php三種語(yǔ)言寫(xiě)法java/** * Http get請求 * @param httpUrl 連接 * @return 響應數據 */ public static String doGet(String httpUrl){ //鏈接 = null; is = null; br = null; result = new (); try { //創(chuàng )建連接 URL url = new URL(httpUrl); = () url.(); //設置請求方式 .("GET"); //設置連接超時(shí)時(shí)間 .(15000); //開(kāi)始連接 .connect(); //獲取響應數據 if (.() == 200) { //獲取返回的數據 is = .(); if (null != is) { br = new (new (is, "utf8")); String temp = null; while (null != (temp = br.readLine())) { result.append(temp); } } } } catch ( e) { e.(); } finally { if (null != br) { try { br.close(); } catch ( e) { e.(); } } if (null != is) { try { is.close(); } catch ( e) { e.(); } } //關(guān)閉遠程連接 .(); } return result.toString(); } public static void main(String[] args) { String url = " String s = doGet(url); String p1 = ".*\\
.*?)\"\\>.*salary\"\\>(?.*?)\\<\\/span\\>.*\"text-city\" href\\=\".*\"\\>(?.*?)\\<\\/p\\>" +
".*\\.*?)\" title=\"(?.*?)\" target\\=\"_blank\"\\>" +
".*\\(?.*?)\\<\\/div\\>.*";
Pattern r1 = Pattern.compile(p1);
Matcher matcher = r1.matcher(s);
while (matcher.find()){
String jobname = matcher.group("jobname");
String salary = matcher.group("salary");
String address = matcher.group("address");
String comlink = matcher.group("comlink");
String comname = matcher.group("comname");
String content = matcher.group("content");
}
}php$url = "
$con = file_get_contents($url);
$reg = ".*.*salary\"\\>(.*?)\\<\\/span\\>.*\"text-city\" href\\=\".*\"\\>(.*?)\\<\\/p\\>" +
".*\\" +
".*\\(.*?)\\<\\/div\\>.*";
$result = preg_match_all($reg,$con,$match_result);
var_dump($match_result);_url = '
headers={"User-Agent":""}
postdata=urllib.parse.urlencode(data).encode('utf-8')
req=urllib.request.Request(url=base_url,headers=headers,data=postdata,method='POST')
response=urllib.request.urlopen(req).read()
html=response.decode()
results1 = re.findall('.*?(\d+).*?就拿大數據說(shuō)話(huà),優(yōu)勢一目了然,從事IT行業(yè),打開(kāi)IT行業(yè)的新大門(mén),找到適合自己的培訓機構,進(jìn)行專(zhuān)業(yè)和系統的學(xué)習。
本文由 全國python學(xué)習中心 整理發(fā)布。更多培訓課程,學(xué)習資訊,課程優(yōu)惠,課程開(kāi)班,學(xué)校地址等學(xué)校信息,可以留下你的聯(lián)系方式,讓課程老師跟你詳細解答:
咨詢(xún)電話(huà):400-850-8622
相關(guān)文章
python爬蟲(chóng)的編寫(xiě),Python如何編寫(xiě)爬蟲(chóng)程序,附高級爬蟲(chóng)實(shí)現思路
python3爬蟲(chóng)一,python3爬蟲(chóng)爬取視頻(一)
python的爬蟲(chóng)程序,Python如何編寫(xiě)爬蟲(chóng)程序,附高級爬蟲(chóng)實(shí)現思路
python爬蟲(chóng)的,Python 爬蟲(chóng)工具
python網(wǎng)絡(luò )爬蟲(chóng)入門(mén),20天學(xué)會(huì )Python爬蟲(chóng):*課-初識爬蟲(chóng)
python什么寫(xiě)爬蟲(chóng),python 怎么寫(xiě)爬蟲(chóng)
python爬蟲(chóng)解析,Python爬蟲(chóng)原理解析
python爬蟲(chóng)入門(mén)6,Python爬蟲(chóng)實(shí)戰入門(mén)六:提高爬蟲(chóng)效率—并發(fā)爬取智聯(lián)招聘
python爬蟲(chóng)基礎教程,Python 爬蟲(chóng)工具
奇米在线7777在线精品|国产成人精品免费视|精品无码不卡一区二区三区|国内综合精品午夜久久资源|亚洲视频在线观看..
.*salary\"\\>(.*?)\\<\\/span\\>.*\"text-city\" href\\=\".*\"\\>(.*?)\\<\\/p\\>" +
".*\\" +
".*\\(.*?)\\<\\/div\\>.*";
$result = preg_match_all($reg,$con,$match_result);
var_dump($match_result);_url = '
headers={"User-Agent":""}
postdata=urllib.parse.urlencode(data).encode('utf-8')
req=urllib.request.Request(url=base_url,headers=headers,data=postdata,method='POST')
response=urllib.request.urlopen(req).read()
html=response.decode()
results1 = re.findall('.*?(\d+).*?就拿大數據說(shuō)話(huà),優(yōu)勢一目了然,從事IT行業(yè),打開(kāi)IT行業(yè)的新大門(mén),找到適合自己的培訓機構,進(jìn)行專(zhuān)業(yè)和系統的學(xué)習。
本文由 全國python學(xué)習中心 整理發(fā)布。更多培訓課程,學(xué)習資訊,課程優(yōu)惠,課程開(kāi)班,學(xué)校地址等學(xué)校信息,可以留下你的聯(lián)系方式,讓課程老師跟你詳細解答:
咨詢(xún)電話(huà):400-850-8622
相關(guān)文章
python爬蟲(chóng)的編寫(xiě),Python如何編寫(xiě)爬蟲(chóng)程序,附高級爬蟲(chóng)實(shí)現思路
python3爬蟲(chóng)一,python3爬蟲(chóng)爬取視頻(一)
python的爬蟲(chóng)程序,Python如何編寫(xiě)爬蟲(chóng)程序,附高級爬蟲(chóng)實(shí)現思路
python爬蟲(chóng)的,Python 爬蟲(chóng)工具
python網(wǎng)絡(luò )爬蟲(chóng)入門(mén),20天學(xué)會(huì )Python爬蟲(chóng):*課-初識爬蟲(chóng)
python什么寫(xiě)爬蟲(chóng),python 怎么寫(xiě)爬蟲(chóng)
python爬蟲(chóng)解析,Python爬蟲(chóng)原理解析
python爬蟲(chóng)入門(mén)6,Python爬蟲(chóng)實(shí)戰入門(mén)六:提高爬蟲(chóng)效率—并發(fā)爬取智聯(lián)招聘
python爬蟲(chóng)基礎教程,Python 爬蟲(chóng)工具
奇米在线7777在线精品|国产成人精品免费视|精品无码不卡一区二区三区|国内综合精品午夜久久资源|亚洲视频在线观看..
就拿大數據說(shuō)話(huà),優(yōu)勢一目了然,從事IT行業(yè),打開(kāi)IT行業(yè)的新大門(mén),找到適合自己的培訓機構,進(jìn)行專(zhuān)業(yè)和系統的學(xué)習。
本文由 全國python學(xué)習中心 整理發(fā)布。更多培訓課程,學(xué)習資訊,課程優(yōu)惠,課程開(kāi)班,學(xué)校地址等學(xué)校信息,可以留下你的聯(lián)系方式,讓課程老師跟你詳細解答:
咨詢(xún)電話(huà):400-850-8622
奇米在线7777在线精品|国产成人精品免费视|精品无码不卡一区二区三区|国内综合精品午夜久久资源|亚洲视频在线观看..