Better way to build hex strings

This commit is contained in:
Cort Buffington 2016-11-20 10:16:53 -06:00
parent 23e862ca56
commit 16198ba889
1 changed files with 2 additions and 1 deletions

View File

@ -160,7 +160,8 @@ for sig in [signal.SIGTERM, signal.SIGINT]:
# Create a 3 byte hex string from an integer
def hex_str_3(_int_id):
try:
return hex(_int_id)[2:].rjust(6,'0').decode('hex')
#return hex(_int_id)[2:].rjust(6,'0').decode('hex')
return format(_int_id,'x').rjust(6,'0').decode('hex')
except TypeError:
logger.error('hex_str_3: invalid integer length')