On Aug 5, 9:35 am, SMERSH009 <[EMAIL PROTECTED]> wrote:
> Hi All.
> Let's say I have some badly formatted text called doc:
>
> doc=
> """
> friendid
> Female
>
>                             23 years old
>
>                             Los Gatos
>
>                             United States
> friendid
> Male
>
>                             24 years old
>
>                             San Francisco, California
>
>                             United States
> """
>
> How would I get these results to be displayed in a format similar to:
> friendid;Female;23 years old;Los Gatos;United States
> friendid;Male; 24 years old;San Francisco, California;United States
>
> The latter is a lot easier to organize and can be quickly imported
> into Excel's column format.
>

You write a script to read your input file and write it out either in
CSV format, using the Python csv module, or just use
';'.join(output_row) if you are sure that there are no ';' characters
in the data.

Is this a homework question?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to