parse_int¶
- hexrec.utils.parse_int(value)[source]¶
Parses an integer.
- Parameters:
value (
Union[str,Any]) – A generic object to convert to integer. In case value is astr(case-insensitive), it can be either prefixed with0xor postfixed withhto convert from a hexadecimal representation, or prefixed with0bfrom binary; a prefix of only0converts from octal. A further suffix applies a scale factor as perSUFFIX_SCALE. ANonevalue evaluates asNone. Any other object class will call the standardint().- Returns:
int – None if value is
None, its integer conversion otherwise.
Examples
>>> parse_int('-0xABk') -175104
>>> parse_int(None) is None True
>>> parse_int(123) 123
>>> parse_int(135.7) 135