Convert octet string to human readable

Posted by Michael Lang on Stack Overflow See other posts from Stack Overflow or by Michael Lang
Published on 2010-12-31T19:17:14Z Indexed on 2010/12/31 19:53 UTC
Read the original article Hit count: 165

Filed under:
|
|

Using the pysnmp framework i get some values doing a snmp walk. Unfortunately for the oid

1.3.6.1.21.69.1.5.8.1.2 (DOCS-CABLE-DEVICE-MIB)

i get a weird result which i cant correctly print here since it contains ascii chars like BEL ACK

When doing a repr i get:

OctetString('\x07\xd8\t\x17\x03\x184\x00')

But the output should look like:

2008-9-23,3:24:52.0

the format is called "DateAndTime". How can i translate the OctetString output to a "human readable" date/time ?

© Stack Overflow or respective owner

Related posts about python

Related posts about decode