[Tutor] How to adjust a text file...

GTXY20 gtxy20 at gmail.com
Thu Sep 27 23:09:45 CEST 2007


Hi,

I have a CSV file as follows:

ID    Products
1     a b c d
1     a e
2     a b c
2     a
3     b c
3     a
4     d
5     a d

I am trying to write a script that will take the CSV file and output another
text file as follows:

ID   Products
1    a
1    b
1    c
1    d
1    a
1    e

etc.. for all of the ID's essentially I need to create a single instance for
products for each ID - currently the products are separated by a space. I am
thinking I need a for loop that will search on the space as a delimiter...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070927/2de654d4/attachment.htm 


More information about the Tutor mailing list