2016-12-30 71 views
0

我在Python中有兩個巨大的列表。可以說,在Python中解壓兩個巨大的列表

countries = ['country names'.....] 
country_codes = ['ccd' .....] 

我試圖使用循環來解開數據,並將其加載到數據庫中,但我得到一個錯誤

"ValueError: too many values to unpack"

需要幫助...

+0

或者我應該在這裏使用Iterator ......還是有其他方法嗎? – Bhargav

回答

3

你應該包括你的代碼,以便更容易看到錯誤。我的猜測是你沒有將列表壓縮在一起:

for country, code in zip(countries, country_codes): 
    #insert country, code into db 
+0

非常感謝...它的工作.. :) – Bhargav

相關問題