Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
lxmlを使用してプログラムでHTMLを作成しているので、出力にカスタムコメントを含める必要があります。lxmlにはコメントに対処するためのコードがありますが(既存のHTMLコードを解析するときにインスタンス化できます)、プログラムでインスタンス化する方法を見つけることができません。
誰か助けてもらえますか?
lxml.etree.Comment()ファクトリ関数を使用できます。他の要素と同じように使用できるコメント要素を返します。
lxml.etree.Comment()