Working with lists within Dictionaries
Chris Angelico
rosuav at gmail.com
Thu Apr 18 10:38:19 EDT 2013
On Thu, Apr 18, 2013 at 11:58 PM, inshu chauhan <insideshoes at gmail.com> 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, []).append(point)
ChrisA
More information about the Python-list
mailing list