且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python:lxml.etree.tostring(with_comments=False)

更新时间:2023-12-05 19:04:28

lxml.etree.tostring 文档说:

exclusive 和 with_comments 参数仅用于 C14N 输出,它们分别请求独占和未注释的 C14N 序列化.

The exclusive and with_comments arguments are only used with C14N output, where they request exclusive and uncommented C14N serialisation respectively.

该参数仅在使用 method='c14n' 时有效.你可以省略它,据我所知,它不会包括评论.即使是这样,接收端的 xml 解析器也应该忽略它们,所以除非有带宽问题或您有特定问题,否则我不会担心.

That parameter is only valid when using method='c14n'. You can omit it, and as far as I know, it will not include comments. Even if it did, the xml parser on the receiving end should ignore them, so unless there's a bandwidth concern or you have a specific problem with it, I wouldn't worry about it.