lxml
を試しましたか?
>>> from lxml.html import builder as E
>>> from lxml.html import usedoctest
>>> html = E.HTML(
... E.HEAD(
... E.LINK(rel="stylesheet", href="great.css", type="text/css"),
... E.TITLE("Best Page Ever")
... ),
... E.BODY(
... E.H1(E.CLASS("heading"), "Top News"),
... E.P("World News only on this page", style="font-size: 200%"),
... "Ah, and here's some more text, by the way.",
... lxml.html.fromstring("<p>... and this is a parsed fragment ...</p>")
... )
...)
>>> print lxml.html.tostring(html)
出力
<html>
<head>
<link href="great.css" rel="stylesheet" type="text/css">
<title>Best Page Ever</title>
</head>
<body>
<h1 class="heading">Top News</h1>
<p style="font-size: 200%">World News only on this page</p>
Ah, and here's some more text, by the way.
<p>... and this is a parsed fragment ...</p>
</body>
</html>
ああ、私はその1つの間で行ってきたが、理由は名前がXMLの、それは私が私がちょうどインストール指示を読んで、それはところで私のために、おそらく – BPm
ないと思いました。ルートアクセスが必要なように見えますが、私はそれをしません。また、libxml2とlibxsltが必要です。私の仕事用コンピュータに更新されたものがあるかどうかは分かりません... – BPm
@BPmええ、でもそれを乗り越えることができます:http://stackoverflow.com/questions/5976030/how-to-install-lxml-for-python Linuxなしで権利管理なし – NullUserException