data parsing
Gnanasekaran Thoppae
gnana at mips.biochem.mpg.de
Fri Feb 23 12:41:59 EST 2001
Hi,
I have some data in a file 'test', which contains:
Joe|25|30|49|40|
|28|39|71||
|30|29|||
Malcolm|43|60|56||
|28|37|||
Amy||70|45||
|40|30||40
|40||30||
This is basically a multi line (record) values that belong
to the first line that starts with a filled field.
This is part belongs to joe 'Joe'
Joe|25|30|49|40|
|28|39|71||
|30|29|||
This to 'Malcolm'
Malcolm|43|60|56||
|28|37|||
and the rest to Amy.
I want to parse this data and format it in this way:
Joe|25;28;30|30;39;29|49;71|40|
Malcolm|43;28|60;37|56||
Amy|40;40|70;30|45;;30|;40;|
Basically speaking, I am trying to cluster multi record
data into one field, each seperated by a delimiter ';' and
if the field is empty, an empty ; will enable later on to
decode the field as empty field ''.
Thanks.
-gnana
More information about the Python-list
mailing list