ValueError: too many values to unpack (expected 2)

时间:2022-09-10 20:21:21

记录下总是码错的地方

for key,value in final_table:#final_table is a dict

然后报错

1 File "./count_co_Mty_read_nu.py", line 190, in count_haplotype_read_number
2     for key,value in final_table:
3 ValueError: too many values to unpack (expected 2)

字典是的迭代元素是字典的key值,多加了一个value值

正确的写法是:

for key,value in final_table.items():