nest expression & Pyparsing[通俗易懂]

2022-07-08 15:57:06 浏览数 (1)

大家好,又见面了,我是全栈君。

http://bbs.csdn.net/topics/330052586

C boost

“<([^<>]*?|(?R))*>”

str = “<abcd<asdfasdf<sdfasdf>>sdaf>”

>>> from pyparsing import nestedExpr >>> data2 = ” <a < b <c>>d>” >>> print nestedExpr(“<“, “>”).parseString(data2).asList() [[‘a’, [‘b’, [‘c’]], ‘d’]] >>> print nestedExpr(“<“, “>”).parseString(data2).asList()[0] [‘a’, [‘b’, [‘c’]], ‘d’] >>>

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/116191.html原文链接:https://javaforall.cn

0 人点赞