in reply to Textfile to csv with a small twist
It seems that what you want to do is refactor the data from:
heading1: h1 text1 h1 text2 h1 text3 heading2: h2 text1 h2 text2 h2 text3 ...
to:
heading1,heading2 h1 text1,h2 text1 h1 text2,h2 text2 h1 text3,h2 text3 ...
in which case you need to read the data into an array of arrays (where each sub array contains all the data for a column with the header first). You then need to write the data out (using one of the csv modules) one field per major array element by unshifting the first element out of each sub array.
If this is what you are trying to achieve and you need more help with the implementation, ask again and you shall receive :).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Textfile to csv with a small twist
by Bentov (Novice) on Aug 29, 2005 at 19:17 UTC |