How to compare lists
denismfmcmahon at gmail.com
Tue Sep 1 13:58:42 CEST 2015
On Tue, 01 Sep 2015 07:08:48 +0200, Jahn wrote:
> How can I save 256 lists, each list has 32 values( hexadecimal numbers)
> 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 at gmail.com
More information about the Python-list