In <344c23f8-f440-4c23-a5e6-9f93b0145...@googlegroups.com> Ho Yeung Lee
writes:
> 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])]
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. T
Ho Yeung Lee 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]]
First try to understand that you get the same
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