gpt4 book ai didi

python - Python 中的内容可见检查

转载 作者:行者123 更新时间:2023-11-28 23:01:46 25 4
gpt4 key购买 nike

大家好!假设我有一些使用此脚本获得的页面:

page = urllib2.urlopen(url).read()

在抓取网页时,如何高效(快速)的检查该内容是否已经被抓取过?我的算法是这样的:

    seenContents = set()
then check if crawled content is in set or not

但我不知道要在那个集合上存储什么,散列值等等?你能推荐一些东西吗?

最佳答案

内容的MD5怎么样?

import md5

contest = "some data"
m = md5.new(contents)
m.digest()

关于python - Python 中的内容可见检查,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10685248/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com