Regular Expressions to parse template tags in XML

后端 未结 2 1576
慢半拍i
慢半拍i 2021-01-22 04:50

I need to parse some XML to pull out embedded template tags for further parsing. I can\'t seem to bend Python\'s regular expressions to do what I want, though.

In Engli

2条回答
  •  悲&欢浪女
    2021-01-22 05:23

    Never ever parse HTML or XML or SGML with regular expressions.

    Always use tools like lxml, libxml2 or Beautiful - they will ever do a smarter and better job than your code .

提交回复
热议问题