Set like feature
Mitja
nun at example.com
Mon Nov 15 17:02:56 EST 2004
On 15 Nov 2004 13:01:52 -0800, Hari Pulapaka <hari04 at gmail.com> wrote:
> Hi,
>
> I have a list of space delimited strings ending in a newline.
> Eg: a = ['a sfds sdf s df 34 ew\n', 'df sdf s f s ssf\n']
>
> Now inside each row, I have a space delimited list of fields.
>
> Now I want to compare the fields in each row of the array and see which
> fields do not match.
>
> Think of it as a 2 dimensional array of size mn, and comparing each
> each element on a column by column basis.
>
> I am using python2.2 so no sets. Can anyone think of an efficient way
> to do this?
If I understand the problem correctly, splitting the lines up and sorting
them before comparison _is_ much better than a naive approach, though I
don't know if that's what's best.
--
Mitja
More information about the Python-list
mailing list