I am trying to convert a set to a list in Python 2.6. I"m using this syntax:
first_list = [1,2,3,4] my_set=set(first_list) my_list = list(my_set)
However, I get the following stack trace:
Traceback (most recent call last): File "<console>", line 1, in <module> TypeError: "set" object is not callable
How can I fix this?
It is already a list
type(my_set) >>> <type "list">
Do you want something like
my_set = set([1,2,3,4]) my_list = list(my_set) print my_list >> [1, 2, 3, 4]
EDIT : Output of your last comment
>>> my_list = [1,2,3,4] >>> my_set = set(my_list) >>> my_new_list = list(my_set) >>> print my_new_list [1, 2, 3, 4]
I"m wondering if you did something like this :
>>> set=set() >>> set([1,2]) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: "set" object is not callable
Executing Data Quality Projects: Ten Steps to Quality Data and Trusted Information (TM), 2nd Edition. Execute Data Quality Projects, Second Edition presents a structured yet flexible approach to cr...
The genesis of this book began in 2012. Hadoop was being explored in mainstream organizations, and we believed that information architecture was about to be transformed. For many years, business intel...
Python for Programmers: with Big Data and Artificial Intelligence Case Studies This book, written for programmers with a high-level experience in another language, uses how-to instructions to teach...
Deep Learning for Coders with fastai and PyTorch: AI Applications Without a PhD. Deep learning is often seen as the exclusive domain of math PhDs and big tech companies. But as this how-to guide sh...