Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95826 > unrolled thread

Re: How to compare lists

Started byjmp <jeanmichel@sequans.com>
First post2015-09-01 11:00 +0200
Last post2015-09-01 11:00 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to compare  lists jmp <jeanmichel@sequans.com> - 2015-09-01 11:00 +0200

#95826 — Re: How to compare lists

Fromjmp <jeanmichel@sequans.com>
Date2015-09-01 11:00 +0200
SubjectRe: How to compare lists
Message-ID<mailman.42.1441098049.23514.python-list@python.org>
On 09/01/2015 07:08 AM, Jahn wrote:
>
>
> 1.
> How can I save 256 lists, each list has 32 values( hexadecimal numbers)
> 2.
> How to compare the saved lists with another 256 lists ( that are read online and have the
> same structure as the list one)?
> ( the first list must be saved in the  previous step)
>
> E.g
>
>
> Thanks
>

Dumb down your problem to something simpler.

saving 2 lists of 2 numbers.

1/ for saving/loading the list, use pickle if *you* will do the saving 
*and* the loading (don't load from an untrusted file)

2/ To compare 2 lists, simply use the == operator

In [4]: [[1,2], [1,2]] == [[1,2], [1,3]]
Out[4]: False

In [5]: [[1,2], [1,2]] == [[1,2], [1,2]]
Out[5]: True

JM

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web