OrderedDict解压缩的值太多了

Nik*_*sov 1 python ordereddictionary

我的节目正在制作:

ValueError:要解压缩的值太多.

我复制了在其他实例中工作的代码行.

new_dict = (("data", 0))
new_dict = collections.OrderedDict(new_dict) #the line producing the error
Run Code Online (Sandbox Code Playgroud)

这个和其他似乎有效的区别在于它们有更多的价值.

Joh*_*ica 5

new_dict = (("data", 0))
Run Code Online (Sandbox Code Playgroud)

这应该是包含键值对的元组.要创建仅包含一个元素的元组,请添加一个尾随逗号.

new_dict = (("data", 0),)
Run Code Online (Sandbox Code Playgroud)