Re: Working with lists within Dictionaries

2013-04-18 Thread Chris Angelico
On Thu, Apr 18, 2013 at 11:58 PM, inshu chauhan wrote: > segments.setdefault(reg_num, [])[point] += point Not sure what your desired structure is. This is seeking to add the point to something indexed by the point; perhaps you simply want to append to the list itself? segments.setdefault(reg_num

Working with lists within Dictionaries

2013-04-18 Thread inshu chauhan
Hello Everyone, I am trying to work with lists and dictionaries together. In the following code I have to access pixels in a segmented image through a dictionary. But the problem is when I am trying to update the list through dict it is giving me this error of tuple, ofcourse because list indices