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


Groups > comp.lang.python > #95828

Re: How to compare lists

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.python
Subject Re: How to compare lists
Date 2015-09-01 11:58 +0000
Organization A noiseless patient Spider
Message-ID <ms43ti$tp0$1@dont-email.me> (permalink)
References <mailman.38.1441092235.23514.python-list@python.org>

Show all headers | View raw


On Tue, 01 Sep 2015 07:08:48 +0200, 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)

Develop code that works for smaller lists. Test it. When it works, try it 
on bigger lists.

For example, you seem to have two very separate requirements:

Save (and presumably read) a list. My favourite mechanism for saving data 
structures is json. Read the json module help. Gogling "python store list 
data" might bring you other suggestions.

Comparing two lists. One method is to step through the members of each 
list in turn, and see if it is in the other list. Another method is to 
check that the lists are the same length, and have the same value at each 
element position. Both may have flaws depending on the exact nature of 
your requirement - and what you consider to be identical lists. Googling 
"python compare lists" may lead you to some ideas.

When you have written and tested your code, if it's not doing what you 
expect, you could come back here and post your code with a description of 
what you think it should do, what it actually does, and why you think 
that's wrong, and we'll try and help you fix.

What we won't do is write your application from scratch.

-- 
Denis McMahon, denismfmcmahon@gmail.com

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


Thread

How to compare  lists "Jahn" <jana1972@centrum.cz> - 2015-09-01 07:08 +0200
  Re: How to compare  lists Denis McMahon <denismfmcmahon@gmail.com> - 2015-09-01 11:58 +0000
  Re: How to compare  lists Rustom Mody <rustompmody@gmail.com> - 2015-09-01 10:26 -0700

csiph-web