давайте предположим следующий фрагмент кода:
page = (
E.html(
E.head(
E.title("This is a sample document")
),
E.body(
E.h1("Hello!", CLASS("title")),
E.p("This is a paragraph with ", B("bold"), " text in it!"),
E.p("This is another paragraph, with a ",
A("link", href="http://www.python.org"), "."),
E.p("Here are some reserved characters: <spam&egg>."),
ET.XML("<p>And finally, here is an embedded XHTML fragment.</p>"),
)
)
)
Источник: https://lxml.de/api/lxml.builder.ElementMaker-class.html
Как добавить атрибут к тегу <body>
в приведенном выше синтаксисе?
Делать что-то вроде этого:
E.body(myattr="something",
не может решить мою проблему. Так что любые советы приветствуются!