python-escpos/escpos/utils.py

10 lines
176 B
Python

try:
bytes.fromhex
def hex2bytes(hex_string):
return bytes.fromhex(hex_string)
except:
def hex2bytes(hex_string):
return hex_string.decode('hex')