I know the easiest way is using a regular expression, but I wonder if there are other ways to do this check.
Why do I need this? I am writing a Python script that re
In Python3, I tried:
def is_hex(s): try: tmp=bytes.fromhex(hex_data).decode('utf-8') return ''.join([i for i in tmp if i.isprintable()]) except ValueError: return ''
It should be better than the way: int(x, 16)