python - BeautifulSoup: Search from leaf to root to get the "deepest" elements first? -


As for a research project, I want to remove all the "documentation units" of a document unit in Python documentation

  • A class (DL class: class)
  • A (DL class: method)
  • section (div squares: section) < P> And as you can guess, they should be nested in such a manner: There are many classes in a section, which have many methods but in reality it is very irregular Is. Example 1: If there are many classes and methods in one section: I want to get each method alone and each class without methods (which I have already received) and Without the classes (which I already have in that case) and methods (which I already have), but with the rest (as there are too many additional things)

    Example2: If there is no method or no section in the class In which they appear, so I have described above them and do not forget them.

    Note: This is not easy, but I would like to get them all into a list which has the same command as the original documentation.

    I tried it with a beautiful soup but I think that for this purpose I have to find "deep root" from the leaf to get the deepest elements - which are beautiful ( afaik) is not supported by Sundasub 4.

    But in reality this is not the main problem.

    I appreciate your point

    It seems that it is not possible .

    So what I did to solve this problem has to be repeated elements (which I was using using .descendants) repeatedly and then I have replaced nested-elements with a placeholder So that the change could make visible (using replace_with).

    As before I used to have dynasties, nested elements are also stored.

  • Comments

    Popular posts from this blog

    Verilog Error: output or inout port "Q" must be connected to a structural net expression -

    jasper reports - How to center align barcode using jasperreports and barcode4j -

    c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -