Python附加字典,TypeError:不可用类型?

use*_*652 7 python dictionary

abc = {}
abc[int: anotherint]
Run Code Online (Sandbox Code Playgroud)

然后错误出现了.TypeError:不可用的类型?为什么我收到这个?我试过str()

pyf*_*unc 8

这似乎是一个语法问题:

>>> abc = {}
>>> abc[1] = 2
>>> abc
{1: 2}
>>> abc = {1:2, 3:4}
>>> abc
{1: 2, 3: 4}
>>> 
Run Code Online (Sandbox Code Playgroud)

至少以下语法不正确

abc[int: anotherint]
Run Code Online (Sandbox Code Playgroud)

我想你想说

abc = [int: anotherint]
Run Code Online (Sandbox Code Playgroud)

这也是不正确的.正确的方法是

abc = {int: anotherint}
Run Code Online (Sandbox Code Playgroud)

除非abc已经在哪种情况下定义:

abc[int] = anotherint
Run Code Online (Sandbox Code Playgroud)

也是一个有效的选择.