python - Adding array to dictionary TypeError: unhashable type: 'list' -
I am unable to add dictionary [3,5] dictionary = {}. I have to check on the solution mentioned above but still the error is coming (TypeError: unhashable type: 'list')
links = [links [i: i + 2] i for category For the range (0, lane, 2)] I range (0, lane (link), 1): print links [i] if not in the links [i]: this is the Lindim Lindicht [link]. (Prob) I want to make dictionary of [3,5] price 0.03.
You are already printing code It should be your attention that every element of the links list is also a list. A dictionary can not contain a list as a key, because dictionaries are based on a hash table and lists can not be washed. Although Tulips can be washed, and they are similar to those lists, so you can try changing the list to Tupal.
In addition, the most straight-forward approach is to handle two cases separately, assuming that you want to capture every match and want to add it to the list. You can also use a defaultdict , which will automatically handle the extra time in the comments as suggested in the comments. If Tupl (Link [i]) is not in Lindy: Lindicht [Tupl ([I]]] = [Pro] Other: Lindicht [Tupl ([[link]]]]. Endend (Pro)
Comments
Post a Comment