如何使用蜘蛛网.pypython模块

2024-10-05 12:25:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经下载了蜘蛛网.py来自here的0.5模块。在蜘蛛网.py文件有很多函数,其中之一是:

def webspider(self, b=None, w=200, d=5, t=None):

    '''Returns two lists of child URLs and paths
    b -- base web URL (default: None)
    w -- amount of resources to crawl (default: 200)
    d -- depth in hierarchy to crawl (default: 5)
    t -- number of threads (default: None)'''

    if b: self.weburls(b, w, d, t)
    return self.webpaths(), self.urls

我在同一个目录中创建了一个新文件,名为运行.py以下内容代码:-在

^{pr2}$

当我执行运行.py我收到以下信息:

NameError: name 'webspider' is not defined

关于如何正确使用这个模块有什么想法吗?我希望所有找到的链接保存到一个名为网址.txt。在


Tags: 模块文件ofto函数pyselfnone

热门问题