Trabla: Python: ValueError: too many values to unpack
Trabla Code:
car_owners = { 'John':['BMW M5','Subaru Legacy'] , 'Alex':['VW Passat B8','Toyota Camry'] , 'Linda':['Bugatti Veyron'] }
for owner, cars in car_owners: #trabla here
for car in cars:
print car
Solving:
car_owners = { 'John':['BMW M5','Subaru Legacy'] , 'Alex':['VW Passat B8','Toyota Camry'] , 'Linda':['Bugatti Veyron'] }
for owner, cars in car_owners.iteritems(): #solving - missing iteritems()
for car in cars:
print car
No comments:
Post a Comment