python - ValueError: too many values to unpack - Is it possible to ignore one value? -


the following line returns error:

self.m, self.usercodetousernamelist, self.itemslist, self.usertokeyhash, self.filetokeyhash = readuserfilematrixfromfile(x,true) 

the function returns 6 values. in case, last 1 useless (its none). want store 5.

is possible ignore last value?

you can use *rest python 3.

>>> x, y, z, *rest = 1, 2, 3, 4, 5, 6, 7 >>> x 1 >>> y 2 >>> rest [4, 5, 6, 7] 

this way can sure not encounter unpacking issues.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -