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
One more simple and short solution based on transformation of string to set and checking for subset (doesn't check for '0x' prefix):
import string def is_hex_str(s): return set(s).issubset(string.hexdigits)
More information here.