开发者

ValueError: need more than 1 value to unpack

Here's the line that throws this error

(x,neighbor) = random.sample(out_edge_list,开发者_StackOverflow1)


You're asking for 1 unique random element. So you're getting back something like [5]. If the 5 goes into x, what goes into neighbor?

Perhaps you meant to ask for 2 elements?

(x, neighbor) = random.sample(out_edge_list, 2)


Here the solution. I changed the line to

(x,neighbor) = random.sample(out_edge_list,1)[0]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜