Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95840
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2015-09-01 10:26 -0700 |
| References | <mailman.38.1441092235.23514.python-list@python.org> |
| Message-ID | <0abed2f9-927e-47b7-ae3a-b13209e415c8@googlegroups.com> (permalink) |
| Subject | Re: How to compare lists |
| From | Rustom Mody <rustompmody@gmail.com> |
On Tuesday, September 1, 2015 at 12:54:08 PM UTC+5:30, 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)
To add to what the others have said/asked:
Many times programmers want sets but they are programmed(!!) to think "Lists!"
This can be because for example
>>> [1,2,3] == [2,1,3]
False
>>> {1,2,3} == {2,1,3}
True
>>> [1,2,3,3] == [1,2,3]
False
>>> {1,2,3,3} == {1,2,3}
True
>>> list(set([1,2,1,3,4,4,]))
[1, 2, 3, 4]
[Though theres no guarantee of the order of the last (that I know) ]
ie you may prefer sets to lists when order and/or repetition dont signify
>
> E.g
???
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll 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