V
V
Viktor Usachov2016-11-28 20:54:39
Python
Viktor Usachov, 2016-11-28 20:54:39

How to change DOM from Python?

Good day, comrades.
How can you change the DOM from Python? Faced with the task, it is necessary to automate making edits to html in python, or rather to replace arbitrary nodes.
For example, there is a list of phrases:

  • "work report"
  • "statistical data",
  • "python rules".

You need to find the p paragraphs containing them and wrap/replace with other tags.
It seems that I figured out how to select most of the tags through lxml (I select div#ID>p , then I compare the text inside with the samples).
Can't figure out how to replace the DOM node.
Please help and point me in the right direction.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2016-11-28
@victor_usachev

stackoverflow.com/questions/7030987/python-injecti...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question