我已经下载了蜘蛛网.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。在
你应该这样称呼它:
或者只能导入
^{pr2}$webspider
:您可以重命名导入的方法:
相关问题 更多 >
编程相关推荐