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


Groups > comp.lang.python > #95826

Re: How to compare lists

Path csiph.com!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'operator': 0.03; 'file)': 0.07; 'subject:How': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '*you*': 0.16; '[4]:': 0.16; 'hexadecimal': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:compare': 0.16; 'wrote:': 0.16; 'load': 0.20; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'compare': 0.27; 'pickle': 0.29; 'another': 0.32; 'subject:lists': 0.32; 'problem': 0.33; 'loading': 0.33; 'structure': 0.34; 'previous': 0.34; 'lists': 0.34; 'list': 0.34; 'false': 0.35; 'saved': 0.35; 'something': 0.35; 'list,': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'save': 0.60; 'your': 0.60; 'received:194': 0.61; 'subject: ': 0.61; 'charset:windows-1252': 0.62; 'saving': 0.70; 'online': 0.71; "(don't": 0.84; 'dumb': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From jmp <jeanmichel@sequans.com>
Subject Re: How to compare lists
Date Tue, 01 Sep 2015 11:00:21 +0200
References <55E54F00.15583.2941C4EC@jana1972.centrum.cz>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host paris.sequans.com
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
In-Reply-To <55E54F00.15583.2941C4EC@jana1972.centrum.cz>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.42.1441098049.23514.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1441098049 news.xs4all.nl 23726 [2001:888:2000:d::a6]:48636
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95826

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web