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
Post a Comment