Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >促进::精神:气::规则或结构包含气::规则的解析结果

促进::精神:气::规则或结构包含气::规则的解析结果
EN

Stack Overflow用户
提问于 2014-12-03 07:03:29
回答 2查看 440关注 0票数 1

我要做的是在运行时从ABNF语法文件创建一个解析器。我已经在qi::语法中实现了所有ABNF规则,如下所示:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
typedef /*qi::rule or struct containing qi::rule*/ parserRule

    [...] //all other ABNF rules according to RFC 5234

    rule =
            (
                    rulename[qi::_a = qi::_1] >>
                    definedAs >>
                    elements[qi::_b = qi::_1] >>
                    cNl
            )[qi::_val = px::bind(&AbnfParserFactory::fromRule, &factory, qi::_a, qi::_b)];


    rulelist =
            +(
                    rule[px::push_back(qi::_a, qi::_1)] |
                    (*cWsp >> cNl)
             ) >>
             eps[qi::_val = px::bind(&AbnfParserFactory::fromRulelist, &factory, qi::_a)];


qi::rule<Iterator, std::map<std::string, parserRule>(), qi::locals<std::vector<parserRule> > >  rulelist;
qi::rule<Iterator, parserRule(), qi::locals<std::string>, qi::locals<parserRule> >              rule;
[...] // all other ABNF rules

ParserFactory内部,根据语法中的读内容创建了一个新的qi::规则:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
std::map<std::string, ReturnType> fromRulelist(std::vector<ReturnType> &rules)
{
    // return a map with <rulename, rule>
};

parserRule fromRule(std::string &name, parserRule &rule)
{
    //name the rule an return it
    rule.name(name);
    return rule;
};

问题在于parserRule的类型。

如果我使用qi::rule作为类型(就像我通常想要的那样),我将丢失在ParserFactory中分配的每个规则名称(如在fromRule中)。我想这是精神内部工作方式造成的(=操作符总是创建一个新的、未命名的规则。=用于分配px::bind函数结果)

但是,如果我试图将qi::rule封装到一个结构中以避免这个问题,那么我就无法再编译我的代码并进行精神调试。以下是我尝试过的:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
typedef qi::rule<std::string::const_iterator, std::string()> FactoryRuleType;
struct parserRule
{
    FactoryRuleType mRule;
};

BOOST_FUSION_ADAPT_STRUCT(
 parserRule,
(FactoryRuleType, mRule)
)

[...] //rule definitions like above

debug(rule);
debug(rulelist);
[...] //debug all other rules

这将给我带来大量编译错误(这是很长的一段时间才能在这里发布)。为了解决这个问题,我已经找了好几天了,但没有任何运气。我希望我能提到足够的细节。

任何帮助都是非常感谢的。

编译输出节选:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
/usr/include/boost/proto/operators.hpp:295:9: note:   template argument deduction/substitution failed:
/usr/include/boost/proto/operators.hpp: In substitution of ‘template<class Left, class Right> const typename boost::proto::detail::enable_binary<boost::proto::domainns_::deduce_domain, boost::proto::detail::not_a_grammar, boost::mpl::or_<boost::proto::is_extension<Arg>, boost::proto::is_extension<Right> >, boost::proto::tagns_::tag::shift_left, Left&, Right&>::type boost::proto::exprns_::operator<<(Left&, Right&) [with Left = std::basic_ostream<char>; Right = const boost::spirit::qi::reference<const boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, std::basic_string<char>()> >]:
/usr/include/boost/spirit/home/support/attributes.hpp:1226:17:   required from ‘static void boost::spirit::traits::print_attribute_debug<Out, T, Enable>::call_impl3(Out&, const T_&, mpl_::false_) [with T_ = boost::spirit::qi::reference<const boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, std::basic_string<char>()> >; Out = std::basic_ostream<char>; T = boost::spirit::qi::reference<const boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, std::basic_string<char>()> >; Enable = void; mpl_::false_ = mpl_::bool_<false>]/usr/include/boost/spirit/home/support/attributes.hpp:1242:67:   required from ‘static void boost::spirit::traits::print_attribute_debug<Out, T, Enable>::call_impl2(Out&, const T_&, mpl_::false_) [with T_ = boost::spirit::qi::reference<const boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, std::basic_string<char>()> >; Out = std::basic_ostream<char>; T = boost::spirit::qi::reference<const boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, std::basic_string<char>()> >; Enable = void; mpl_::false_ = mpl_::bool_<false>]/usr/include/boost/spirit/home/support/attributes.hpp:1277:52:   required from ‘static void boost::spirit::traits::print_attribute_debug<Out, T, Enable>::call_impl(Out&, const T_&, mpl_::true_) [with T_ = boost::spirit::qi::reference<const boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, std::basic_string<char>()> >; Out = std::basic_ostream<char>; T = boost::spirit::qi::reference<const boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, std::basic_string<char>()> >; Enable = void; mpl_::true_ = mpl_::bool_<true>]/usr/include/boost/spirit/home/support/attributes.hpp:1283:52:   required from ‘static void boost::spirit::traits::print_attribute_debug<Out, T, Enable>::call(Out&, const T&) [with Out = std::basic_ostream<char>; T = boost::spirit::qi::reference<const boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, std::basic_string<char>()> >; Enable = void]/usr/include/boost/spirit/home/support/attributes.hpp:1303:53:   required from ‘void boost::spirit::traits::print_attribute(Out&, const T&) [with Out = std::basic_ostream<char>; T = boost::spirit::qi::reference<const boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, std::basic_string<char>()> >]/usr/include/boost/spirit/home/support/attributes.hpp:1196:57:   [ skipping 34 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/boost/function/function_template.hpp:722:7:   required from ‘boost::function4<R, T1, T2, T3, T4>::function4(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = boost::spirit::qi::debug_handler<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, boost::spirit::context<boost::fusion::cons<FactoryReturnType&, boost::fusion::nil>, boost::fusion::vector0<> >, boost::spirit::unused_type, boost::spirit::qi::simple_trace>; R = bool; T0 = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >&; T1 = const __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >&; T2 = boost::spirit::context<boost::fusion::cons<FactoryReturnType&, boost::fusion::nil>, boost::fusion::vector0<> >&; T3 = const boost::spirit::unused_type&; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]/usr/include/boost/function/function_template.hpp:1069:16:   required from ‘boost::function<R(T0, T1, T2, T3)>::function(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = boost::spirit::qi::debug_handler<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, boost::spirit::context<boost::fusion::cons<FactoryReturnType&, boost::fusion::nil>, boost::fusion::vector0<> >, boost::spirit::unused_type, boost::spirit::qi::simple_trace>; R = bool; T0 = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >&; T1 = const __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >&; T2 = boost::spirit::context<boost::fusion::cons<FactoryReturnType&, boost::fusion::nil>, boost::fusion::vector0<> >&; T3 = const boost::spirit::unused_type&; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]/usr/include/boost/function/function_template.hpp:1124:5:   required from ‘typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, boost::function<R(T0, T1, T2, T3)>&>::type boost::function<R(T0, T1, T2, T3)>::operator=(Functor) [with Functor = boost::spirit::qi::debug_handler<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, boost::spirit::context<boost::fusion::cons<FactoryReturnType&, boost::fusion::nil>, boost::fusion::vector0<> >, boost::spirit::unused_type, boost::spirit::qi::simple_trace>; R = bool; T0 = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >&; T1 = const __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >&; T2 = boost::spirit::context<boost::fusion::cons<FactoryReturnType&, boost::fusion::nil>, boost::fusion::vector0<> >&; T3 = const boost::spirit::unused_type&; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, boost::function<R(T0, T1, T2, T3)>&>::type = boost::function<bool(__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >&, const __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >&, boost::spirit::context<boost::fusion::cons<FactoryReturnType&, boost::fusion::nil>, boost::fusion::vector0<> >&, const boost::spirit::unused_type&)>&]/usr/include/boost/spirit/home/qi/nonterminal/debug_handler.hpp:122:13:   required from ‘void boost::spirit::qi::debug(boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>&) [with Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >; T1 = FactoryReturnType(); T2 = boost::spirit::unused_type; T3 = boost::spirit::unused_type; T4 = boost::spirit::unused_type]../src/AbnfReader.hpp:350:14:   required from ‘AbnfRules<Iterator>::AbnfRules() [with Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >]../src/AbnfReader.cpp:27:12:   required from here
/usr/include/boost/proto/operators.hpp:295:9: error: no type named ‘type’ in ‘struct boost::proto::detail::enable_binary<boost::proto::domainns_::deduce_domain, boost::proto::detail::not_a_grammar, boost::mpl::or_<boost::proto::is_extension<std::basic_ostream<char> >, boost::proto::is_extension<const boost::spirit::qi::reference<const boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, std::basic_string<char>()> > >, mpl_::bool_<false>, mpl_::bool_<false>, mpl_::bool_<false> >, boost::proto::tagns_::tag::shift_left, std::basic_ostream<char>&, const boost::spirit::qi::reference<const boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, std::basic_string<char>()> >&>make: *** [src/AbnfReader.o] Error 1
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-12-06 12:38:25

这太尴尬了。当我试图像sehe建议的那样编写一个SSCCE时,我发现我的方法实际上一直在起作用。为了解决这个问题我遇到了很多麻烦.:C

下面是我想要做的事情的一个例子。虽然有效,但行为仍然有点奇怪,这也是我认为它不是这样工作的原因。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>

namespace qi = boost::spirit::qi;
namespace px = boost::phoenix;
namespace ascii = boost::spirit::ascii;

typedef qi::rule<std::string::const_iterator, std::string()> parserRule;


namespace std
{
std::ostream& operator<<(std::ostream& stream, const parserRule& val);
}
std::ostream& std::operator<<(std::ostream& stream, const parserRule& val)
{
    stream << "RULE( " << val.name();
    stream << " )";
    return stream;
}

class Factory
{
public:
    Factory(){}
    parserRule createParser(std::string str)
    {
        parserRule r;
        r = qi::char_(str);
        r.name("FactoryRule");
        std::cout << r.name() << " now parses >" + str + "<" << std::end;
        return r;
    }
};

template <typename Iterator>
struct TestGrammar : qi::grammar<Iterator, parserRule()>
{

    TestGrammar() : TestGrammar::base_type(start, "Test grammar")
    {
        start = stringRule.alias();
        stringRule =    (
                ascii::char_("'") >>
                *(ascii::char_ - ascii::char_("'"))[qi::_a += qi::_1] >>
                ascii::char_("'")
        )[qi::_val = px::bind(&Factory::createParser, &factory, qi::_a)];

        start.name("Start");
        stringRule.name("StringRule");

        qi::debug(start);       // shows "RULE( unnamed-rule )"
        qi::debug(stringRule);  // shows "RULE( unnamed-rule )"
    }

    qi::rule<Iterator, parserRule() > start;
    qi::rule<Iterator, parserRule(), qi::locals<std::string> > stringRule;
    Factory factory;
};

int main()
{
    typedef std::string::const_iterator iterator_type;
    typedef TestGrammar<iterator_type> TGrammar;


    TGrammar test_parser;

    std::string test = "parse THIS!";
    std::string input = "'"+test+"'";
    parserRule result;

    std::string::const_iterator iter = input.begin();
    std::string::const_iterator end = input.end();

    bool r = parse(iter, end, test_parser, result);

    if (r && iter == end)
    {
        std::cout << "-------------------------\n";
        std::cout << "1st Parsing succeeded\n";
        std::cout << "-------------------------\n";
    }
    else
    {
        std::string rest(iter, end);
        std::cout << "-------------------------\n";
        std::cout << "1st Parsing failed\n";
        std::cout << "stopped at: \"" << rest << "\"\n";
        std::cout << "-------------------------\n";
    }

    iterator_type first(test.begin()), last(test.end());

    qi::debug(result); //shows correct rule name
    r = qi::phrase_parse(first, last, result, boost::spirit::ascii::space);

    if (r && iter == end)
    {
        std::cout << "-------------------------\n";
        std::cout << "2nd Parsing succeeded\n";
        std::cout << "-------------------------\n";
    }
    else
    {
        std::string rest(first, last);
        std::cout << "-------------------------\n";
        std::cout << "2nd Parsing failed\n";
        std::cout << "stopped at: \"" << rest << "\"\n";
        std::cout << "-------------------------\n";
    }
}

这是输出:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
FactoryRule now parses >parse THIS!<
<Start>
  <try>'parse THIS!'</try>
  <StringRule>
    <try>'parse THIS!'</try>
    <success></success>
    <attributes>[[RULE( unnamed-rule )]]</attributes><locals>(parse THIS!)</locals>
  </StringRule>
  <success></success>
  <attributes>[[RULE( unnamed-rule )]]</attributes>
</Start>
-------------------------
1st Parsing succeeded
-------------------------
<FactoryRule>
  <try>parse THIS!</try>
  <success>arse THIS!</success>
  <attributes>[[p]]</attributes>
</FactoryRule>
-------------------------
2nd Parsing succeeded
-------------------------

如您所见,调试规则startstringRule将始终将“规则(未命名-规则)”显示为属性。这使我相信,由于在分配=-operator结果时使用了px::bind,所以分配的规则名丢失了。因为调试result规则会显示正确的名称,所以我假设“未命名规则”输出并不显示正确的最终合成属性,而是显示当前的“空”属性。

当我看到“未命名的规则”和花费了很多天的时间试图解决这个问题,甚至在没有通过调试result规则来测试整个事情的情况下在这里问的时候,我感到非常遗憾。

不管怎样,谢谢你帮我。我希望这至少对其他人有用。

票数 1
EN

Stack Overflow用户

发布于 2014-12-03 07:31:06

这里有两个问题,仅凭经验,无需编写进一步的代码:

  1. 单元素适配结构会产生问题,请参阅:链接来了。
  2. 调试信息需要调试打印特征的专门化(返回到ostream流)。显然,对于qi::rule来说,这一点还没有完成。所以要么加进去。 也许,只是也许您可以使包含的结构iostream-能够避免它(但我担心融合适应可能优先。值得一试)

问:是的,你是对的。我必须在运行时动态地编写语法。为了确保这是可能的,我已经编写了一堆测试片段,它们按预期工作。

  • 直截了当地说:精神不是实现这一目标的工具。灵性是一个工具,它从"praser表达式“(即表达式模板)生成静态编译的语法。总体目标是编译时,使用静态多态性进行完全优化。我建议可能创建一组运行时多态解析器组件(反过来,您可以使用精灵:实现这些组件),并从它们中构建动态语法。 一种可能的中间路线是使用qi::lazy和一组预定义的不可变的“原子”规则(所以不是动态合成的),并使用这些引用的“原子”规则组成解析器。
  • 基本上,只要您不尝试动态组合表达式模板(而是准备好的类型擦除的非终端),您就应该没事。 如果你需要更多的话,你很快就会到UB的。有些时候,您可以使用boost::proto::deep_copy来解决问题,但这是有局限性的。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27274969

复制
相关文章
Scrapy中Xpath的使用
请注意,本文编写于 990 天前,最后修改于 990 天前,其中某些信息可能已经过时。
曼亚灿
2023/05/17
9300
Scrapy框架中的xpath选择
不同于我们普通爬虫获取xpath,scrapy获得xpath对象获取他的值语法 一.xpath对象获取值 xpath对象..extract() 二.Scrapy框架独有的xpath取值方式 利用hre
小小咸鱼YwY
2020/06/19
9910
scrapy选择器xpath
Scrapy提取数据有自己的一套机制,它们被称作选择器(seletors),通过特定的Xpath或者css表达式来"选择"html文件中的某个部分。
py3study
2018/08/02
6040
Scrapy实战5:Xpath实战训练
    今天给大家分享的是,如何在cmd和pycharm中启动自己的spider以及Xpath的基本介绍,并利用Xpath抓取伯乐在线单篇文章基本信息。
龙哥
2020/02/12
7650
【python爬虫】scrapy框架笔记(一):创建工程,使用scrapy shell,xpath
scrapy是个好东西,它的官方文档写的很详细,很适合入门。链接:http://scrapy-chs.readthedocs.io/zh_CN/1.0/index.html
蛮三刀酱
2019/03/26
6280
【python爬虫】scrapy框架笔记(一):创建工程,使用scrapy shell,xpath
Scrapy框架| 选择器-Xpath和CSS的那些事
这次接着上一篇文章来讲Scrapy框架,这次讲的是Scrapy框架里面提供的两种数据提取机制Xpath和CSS,其实除了这两种,我们还可以借助第三方库来实现数据的提取,例如:BeautifulSoup(这个在我的爬虫系列文章中有写过)和lxml(Xml解析库),Scrapy选择器是基于lxml库之上的,所以很多地方都是和lxml相似的。
Python进击者
2019/06/21
1.3K0
scrapy框架精讲!如何在最短的时间内学会xpath语法
XPath 是一门在 XML 文档中查找信息的语言。XPath 可用来在 XML 文档中对元素和属性进行遍历。
云飞
2018/09/13
6790
python网络爬虫(14)使用Scrapy搭建爬虫框架
爬虫框架也许能简化工作量,提高效率等。scrapy是一款方便好用,拓展方便的框架。
嘘、小点声
2019/07/31
6410
xpath路径的写法
3.查找页面上第一个form元素内的直接子input元素(即只包括form元素的下一级input元素,使用绝对路径表示, 单/号)://form[1]/input
小小咸鱼YwY
2019/07/24
1.9K0
scrapy爬取1024种子
1024不必多说,老司机都懂,本文介绍scrapy爬取1024种子,代码不到50行!Scrapy,Python开发的一个快速、高层次的屏幕抓取和web抓取框架,用于抓取web站点并从页面中提取结构化的数据。Scrapy用途广泛,可以用于数据挖掘、监测和自动化测试。 关于scrapy用下图来说明即可(图片来自https://cuiqingcai.com/3472.html )
LiosWong
2019/03/14
3K0
scrapy爬取1024种子
(原创)七夜在线音乐台开发 第三弹 爬虫篇
上一篇咱们讲到了七夜音乐台的需求和所需要的技术。咱们今天就讲一下爬虫,为什么要讲爬虫,因为音乐台的数据源需要通过爬虫来获取,不可能手动来下载。下图是一个网络爬虫的基本框架: 网络爬虫的基本工作流程如下
七夜安全博客
2018/06/26
1.1K0
Python——Scrapy初学
Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架。可以应用在包括数据挖掘,信息处理或存储历史数据等一系列的程序中。Scrapy最初是为了页面抓取(更确切来说, 网络抓取)所设计的,也
闪电gogogo
2018/01/08
1.9K0
Python——Scrapy初学
Scrapy 爬虫实例(一)
在开始爬取之前,您必须创建一个新的Scrapy项目。 进入您打算存储代码的目录中,运行下列命令:
HLee
2021/06/10
6010
Scrapy 爬虫实例(一)
Python 爬虫之Scrapy《中》
Scrapy数据解析主要有两个大类:xpath() 和 css() ,今天这篇文章主要讲解xpath如何解析我们想获取的页面数据。同时Scrapy还给我们提供自己的数据解析方法,即Selector(选择器),Selector是一个可独立使用的模块,我们可以用Selector类来构建一个选择器对象,然后调用它的相关方法如xpaht(), css()等来提取数据,它的常用写法如下:
Wu_Candy
2022/07/04
8640
Python 爬虫之Scrapy《中》
Python最火爬虫框架Scrapy入门与实践,豆瓣电影 Top 250 数据采集
Python爬虫框架Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架,非常出名,非常强悍。所谓的框架就是一个已经被集成了各种功能(高性能异步下载,队列,分布式,解析,持久化等)的具有很强通用性的项目模板。对于框架的学习,重点是要学习其框架的特性、各个功能的用法即可。
二爷
2020/07/22
2.4K0
Python最火爬虫框架Scrapy入门与实践,豆瓣电影 Top 250 数据采集
XML 的 XPath 语法
2018-06-24 11:43
walterlv
2018/09/18
1.1K0
chrome xpath的使用
最近研究爬虫的时候,发现chrome也支持xpath,用法如下,在console中输入
用户2936342
2018/08/27
1.1K0
chrome xpath的使用
Python网络爬虫(六)- Scrapy框架1.Scrapy2.安装和配置3.安装过程常见错误4.代码操作 - 创建一个Scrapy项目5.Scrapy框架进阶 - 深度爬虫
Scrapy Engine(Scrapy核心) 负责数据流在各个组件之间的流。Spiders(爬虫)发出Requests请求,经由Scrapy Engine(Scrapy核心) 交给Scheduler(调度器),Downloader(下载器)Scheduler(调度器) 获得Requests请求,然后根据Requests请求,从网络下载数据。Downloader(下载器)的Responses响应再传递给Spiders进行分析。根据需求提取出Items,交给Item Pipeline进行下载。Spiders和Item Pipeline是需要用户根据响应的需求进行编写的。除此之外,还有两个中间件,Downloaders Mddlewares和Spider Middlewares,这两个中间件为用户提供方面,通过插入自定义代码扩展Scrapy的功能,例如去重等。
Python攻城狮
2018/08/23
1.7K0
Python网络爬虫(六)- Scrapy框架1.Scrapy2.安装和配置3.安装过程常见错误4.代码操作 - 创建一个Scrapy项目5.Scrapy框架进阶 - 深度爬虫
Python网络爬虫(四)- XPath1.XPath2.XPath在python中的应用
XPath 即为XML路径语言(XML Path Language),它是一种用来确定XML文档中某部分位置的语言。它使用路径表达式来选取 XML 文档中的节点或节点集。节点是通过沿着路径 (path) 或者步 (steps) 来选取的。 XPath语法
Python攻城狮
2018/08/23
1.4K0
Python网络爬虫(四)- XPath1.XPath2.XPath在python中的应用
Python爬虫项目--爬取链家热门城市
本次实战是利用爬虫爬取链家的新房(声明: 内容仅用于学习交流, 请勿用作商业用途)
py3study
2020/01/20
7640

相似问题

信号处理:常规音频“节拍”检测

116

时钟节拍和时钟周期的概念

418

Java中的MIDI节拍时钟

10

在节拍数据的价格图上绘制交易进入信号

10

在Javascript中模拟MIDI节拍时钟

10
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文