May be its an absurd question but I have this code:
from itertools import product
variable_ = 'variable_'
for i,oid, val in product(xrange(0,7), varBinds):
variable_ += `i`
print('%s = %s' % (variable_,val.prettyPrint()))
I get the error ValueError: need more than 2 values to unpack
.I don't want to use oid for now but may be later in the same loop I'll require it. I searched for the error and possible solutions but none worked.
All i want to do is for i in range(0,7) && for oid, val in varBinds
, and get expected data as
variable_0=<some value in varBinds>
variable_1=<some other value in varBinds>
.
.
variable_6=<last value in varBinds>
how can i do that?
UPDATE:
This is what i did:
for i, (oid, val) in enumerate(varBinds):
variable_ += `i`
print('%s = %s' % (variable_,val.prettyPrint()))
variable_="variable_"
Worked Perfectly. Thanks @RemcoGerlich for the help