formatting a string in python based on pixels
<p>I am reading an xml file in python and then displaying it on a web gui
The reading code is pretty straightforward</p>

<pre><code>def home ():
    file = "sample.xml"
    contents = open(file).read()
    contents = contents.decode('utf-8')
</code></pre>

<p>And then there is whole lot of front end code consisting of html and css...</p>

<p>But... to display it.. I want that the each line doesnt exceeds say 200px??</p>

<p>i.e insert a newline(??) after n pixels..</p>

<p>How can I do this in python.. </p>
