How to compare lists

Laura Creighton lac at openend.se
Tue Sep 1 11:29:28 CEST 2015


In a message of Tue, 01 Sep 2015 07:08:48 +0200, "Jahn" writes:
>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)

'Saving' can mean many things, depending on context. You can save a
reference to your list which will last as long as that reference is
in scope in your program.  If you only need to save it for as
long as it takes you to read in another value, also done in the
same scope of your program, this will be fine.

If, on the other hand you want to get your next values you want
to compare things to, by running a program, either this one or
a different one, tomorrow, next week, then you will probably want
to save your list in a file somewhere.

And if you want to save it in a way that you won't lose the data,
even if your disk drive breaks, your house burns down and all your
posessions are destroyed ... then you probably want to save it
in the cloud someplace -- and make sure that the data is mirrored
because data centres burn down, on occasion, as well.

So that is the first problem.  'What do you mean by save?'  which
is related to 'How and when are you getting these lists, anyway?'
The next problem is similar.  'What do you mean by same?'

Here is a list:  ['Anders', 'Sigbritt', 'Eva']
and here is another list: ['Eva', 'Sigbritt', 'Anders']

They aren't equal.  But are they 'the same'?  This isn't a
programming question, but a question of 'How is your problem
defined?'  You need to know the answer to this before you can
write your code, which may mean asking the problem giver
to clarify what he or she meant by 'same'.

Laura


More information about the Python-list mailing list