Hello there, Ho Yeung Lee, The use of groupkey[tuple([0,3])] to the right of the = is attempting to access an entry in your dictionary that you have not already created. That is why you are getting the error message. You need to create an entry whose key is tuple([0,3]) before you can access it. The following code does not provoke an error message:
groupkey = {(0,0): []} groupkey = {tuple([0,3]): []} groupkey[tuple([0,3])] = groupkey[tuple([0,3])] + [[0,1]] I hope this helps you. Stephen. <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> On Fri, Jun 30, 2017 at 11:35 AM, Ho Yeung Lee <jobmatt...@gmail.com> wrote: > I find that list can not be key in dictionary > then find tuple can be as key > > but when I add new tuple as key , got error in python 2.7 > > groupkey = {(0,0): []} > groupkey[tuple([0,3])] = groupkey[tuple([0,3])] + [[0,1]] > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list