如果我嘗試這樣的事情,我pysnmp - ValueError異常:值過多解壓(預計4)
ValueError: too many values to unpack (expected 4)
有人能解釋爲什麼嗎?
from pysnmp.hlapi import *
errorIndication, errorStatus, errorIndex, varBinds = nextCmd(
SnmpEngine(),
CommunityData('public', mpModel=1),
UdpTransportTarget(('giga-int-2', 161)),
ContextData(),
ObjectType(ObjectIdentity('1.3.6.1.2.1.31.1.1.1.1')),
lexicographicMode=False
)
if errorIndication:
print(errorIndication)
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
else:
for v in varBinds:
for name, val in v:
print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))
的可能的複製[Python的ValueError異常:值過多解壓](https://stackoverflow.com/questions/7053551/python-valueerror-too-many-values-to-unpack) –
的可能的複製['太多的值解開',迭代字典。 key => string,value => list](https://stackoverflow.com/questions/5466618/too-many-values-to-unpack-iterating-over-a-dict-key-string-value-list) – chrisis