<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 24/02/2014 20:48, Dante Loi wrote:</div>
<blockquote
cite="mid:CANkcjMEQqFUemZicaxN4RbMm5cvM=exVQy5dpH1D3bs683=CvA@mail.gmail.com"
type="cite">
<div dir="ltr"><br>
<div>
<div>
<pre style="margin-top:0px;margin-bottom:0px;padding:15px;border:0px;outline:0px;font-size:13px;vertical-align:baseline;background-color:transparent;font-family:monospace,sans-serif;word-wrap:normal;overflow:auto;color:rgb(85,85,85);line-height:18px"><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(64,128,128);font-style:italic">#!/usr/bin/python</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(0,128,0)">import</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,255);font-weight:bold">string</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(0,128,0)">import</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,255);font-weight:bold">sys</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">infile</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">=</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(0,128,0)">open</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">(</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">sys</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">argv</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">[</span><span class="" style="ma
rgin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(102,102,102)">1</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">],</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">'r'</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">)</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">outfile</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">=</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(0,128,0)">open</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">(</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">sys</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">argv</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">[</span><span class="" style="m
argin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(102,102,102)">2</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">],</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">'w'</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">)</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">outfile</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">write</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">(</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">"<?xml version=</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(187,102,34);font-weight:bold">\"</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">1.0</span><span class="" style="margin:0px;padding:0
px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(187,102,34);font-weight:bold">\"</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)"> encoding=</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(187,102,34);font-weight:bold">\"</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">utf-8</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(187,102,34);font-weight:bold">\"</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">?></span><span class="" style="margin:0px;padding:0px;border:0px;outli
ne:0px;vertical-align:baseline;background-color:transparent;color:rgb(187,102,34);font-weight:bold">\n</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)"><resources></span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(187,102,34);font-weight:bold">\n</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">"</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">)</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(0,128,0);font-weight:bold">for</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">line</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(170,34,255);font-weight:bold">in</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">infile</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">readlines</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">():</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(0,128,0);font-weight:bold">if</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">line</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">strip</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">():</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">name</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">,</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">value</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">=</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">[</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">word</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">strip</span><span class="" style="margin:0px;padding:0px;border:0px;outli
ne:0px;vertical-align:baseline;background-color:transparent">()</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(0,128,0);font-weight:bold">for</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">word</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(170,34,255);font-weight:bold">in</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">line</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">split</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">(</span><span class="" style
="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">"="</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">,</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(102,102,102)">1</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">)</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">]</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">outfile</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">write</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">(</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">"</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(187,102,34);font-weight:bold">\t</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)"><string name=</span><span class="" style="margin:0px;paddi
ng:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(187,102,34);font-weight:bold">\"</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">"</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">+</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">name</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">+</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">"</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(187,102,34);font-weight:bold">\"</span><span class="" style="margin:0px;paddin
g:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">>"</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">+</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">value</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">+</span> <span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">"</string></span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(187,102,34);font-weight:bold">\n</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">"</span><span class="" style="margin:0px;paddin
g:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">)</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">outfile</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">write</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">(</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent;color:rgb(186,33,33)">"</resources>"</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">)</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">infile</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">close</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">()</span>
<span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">outfile</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;color:rgb(102,102,102)">.</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline">close</span><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">()</span></pre>
<pre style="margin-top:0px;margin-bottom:0px;padding:15px;border:0px;outline:0px;font-size:13px;vertical-align:baseline;background-color:transparent;font-family:monospace,sans-serif;word-wrap:normal;overflow:auto;color:rgb(85,85,85);line-height:18px"><span class="" style="margin:0px;padding:0px;border:0px;outline:0px;vertical-align:baseline;background-color:transparent">se volete proporre qualche miglioria è ben'accetta comunque funziona alla perfezione!</span>
</pre>
</div>
</div>
</div>
</blockquote>
Per l'output puoi dare un'occhiata a format:<br>
<a class="moz-txt-link-freetext" href="http://docs.python.org/2.7/library/stdtypes.html?highlight=format#str.format">http://docs.python.org/2.7/library/stdtypes.html?highlight=format#str.format</a><br>
<br>
Ciao<br>
diego<br>
</body>
</html>