'Iterable to a list in python
my_list = [1, 2, 4, 3, 4, 3, 6, 6]
set_var = set(my_list)
list_var = list(set_var)
print(list_var)
As you can see, the purpose of the snippet above is to remove repeating numbers from my_list. I admit that there are many ways to do this, but using the set() function seems the most convenient.
But converting set_var, which is a set variable, into a list, generates a TypeError :
TypeError: 'list' object is not callable
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
