<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">I have
<meta name="Generator" content="Kate, the KDE Advanced Text Editor">
<pre>tree <span style="color: rgb(255, 0, 255);">=</span> ET.ElementTree<span style="color: rgb(255, 0, 255);">(</span>root<span style="color: rgb(255, 0, 255);">)</span></pre>How can i put tree in a string?<br><br><div>
<span class="gmail_quote">2006/1/20, Fredrik Lundh <<a href="mailto:fredrik@pythonware.com">fredrik@pythonware.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Sbaush wrote:<br><br>> Is possible to have the XML in a string (for example xmlstring) and for<br>> printing do a print xmlstring ?<br><br>most about anything that can be written to a file can be written to a string
<br>using the StringIO module:<br><br> <a href="http://www.effbot.org/librarybook/stringio.htm">http://www.effbot.org/librarybook/stringio.htm</a><br><br> file = StringIO.StringIO()<br> tree.write(file)<br> data =
file.getvalue()<br><br>for elementtree, you can also use the tostring function:<br><br> data = ET.tostring(elem)<br><br></F><br><br><br><br>_______________________________________________<br>XML-SIG maillist -
<a href="mailto:XML-SIG@python.org">XML-SIG@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/xml-sig">http://mail.python.org/mailman/listinfo/xml-sig</a><br></blockquote></div><br><br clear="all"><br>--
<br>Sbaush