after sorted from the lists
Ben Bush
pythonnew at gmail.com
Tue Nov 22 10:07:15 EST 2005
On 11/22/05, Ben Bush <pythonnew at gmail.com> wrote:
> I have a list:
> [[1,2],[2,1],[3,1],[1,4],[3,3],[1,4]]
> How to remove all the duplicate or same after sorted from the lists?
> That is, [1,2] and [2,1] are the same after sorting them.
> I want the result to be:
> [[1,2],[3,1],[1,4],[3,3]]
I want to set it first but it does not work:
>>> q=[[1,2],[2,1],[3,1],[1,4],[3,3],[1,4]]
>>> set(q)
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python23\lib\sets.py", line 429, in __init__
self._update(iterable)
File "C:\Python23\lib\sets.py", line 374, in _update
data[element] = value
TypeError: list objects are unhashable
More information about the Python-list
mailing list