Python Error
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Jul 29 10:01:17 EDT 2012
On Sun, 29 Jul 2012 05:30:15 -0700, subhabangalore wrote:
> Dear Peter,
> Thanks for the answer. But my list does not contain another list that is
> the issue. Intriguing.
That is not what the error message says. You said that this line of code:
set1=set(list1)
gives this error:
TypeError: unhashable type: 'list'
Almost certainly, either you are mistaken about the line of code which
gives the error, or you are mistaken about the error, or you are mistaken
that your list does not contain any lists.
> Thinking what to do.
Exactly what Peter suggested: print the list before you try to convert it
to a set, and see what it actually contains.
It will also help you to read this page and try to follow its advice:
http://sscce.org/
--
Steven
More information about the Python-list
mailing list