系統出現異常: too many values to unpack (expected 2)


先感謝[ValueError: too many values to unpack](http://leonzhan.iteye.com/blog/1720315)
系統出現異常:打開太多值(預期2)
這種錯誤是指一個tuple值賦給一個tuple變量時,變量個數不夠。如:a,b = (1,2,3)
for example: if ditc_a is dict, following code will get this error
for key, value in ditc_a:
...

Correct:
for key, value in ditc_a.items():
於是我在原代碼上添加 'items()',如下:

> for temp_name_interface,condition in temp_moduel_execute.items():

---
后記:這個代碼最先是iteritems(),后面運行報錯,我就把iteritems(),改成了items(),還報錯,我就把items()給去掉了,於是出現標題中錯誤。恩,轉了一圈又回來了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM