統計 text html 文件型別

2021-06-05 22:29:06 字數 530 閱讀 2524

使用heritrix抓取的網頁儲存在jobs/crawler/mirror下,判斷抓取的檔案是否是text/html 文件型別,只需要判斷檔案中是否含有 「text/html」 字串,使用bufferedreader類中的readline()方法讀取檔案每一行,檢查其是否包含該串,如果有則說明是text/html 文件,否則,一直讀到檔案末尾仍未包含,則不是text/html 文件。

遍歷jobs資料夾下每個crawler資料夾,找到其目錄下的mirror資料夾,對其進行深度優先搜尋,找到目錄樹的每一片葉子(即檔案),檢索檔案,檢查是否包含「text/html」字串,如果有,則計數器加1。

public

voidsearchfile(file file)

}}catch(ioexception e)finally

}catch(ioexception e)

}}else}}

python 統計文件

usr bin python coding utf 8 import datetime import smtplib import string yesterday datetime.datetime.now datetime.timedelta days 1 yesterday yesterday...

文件模式和文件型別

文件模式和文件型別 1 2doctype html public w3c dtd html 4.01 en 3 html lang en 4 head 5 meta charset utf 8 6 title 文件模式和文件型別 title 7 style 8.code 13style 14head...

文件模式和文件型別

文件模式和文件型別 1 2doctype html public w3c dtd html 4.01 en 3 html lang en 4 head 5 meta charset utf 8 6 title 文件模式和文件型別 title 7 style 8.code 13style 14head...