Data Manipulation - Rows to Columns

Tess testone at gmail.com
Tue Feb 5 21:54:49 EST 2008


Hello All,

I have a text file with marked up data that I need to convert into a
text tab separated file.

The structure of the input file is listed below (see file 1) and the
desired output file is below as well (see file 2).

I am a complete novice with python and would appreciate any tips you
may be able to provide.

Best,

Tess



file 1:
<item>TABLE</table>
<color>black</color>
<color>blue</color>
<color>red</color>
<item>CHAIR</table>
<color>yellow</color>
<color>black</color>
<color>red</color>
<item>TABLE</table>
<color>white</color>
<color>gray</color>
<color>pink</color>


file 2 (tab separated):
TABLE	black	blue	red
CHAIR	yellow	black	red
TABLE	white	gray	pink



More information about the Python-list mailing list