alias
convert hex string to integer
alias lang_id
how to
convert hex string to integer
lang_id
python
qid
28007

How to
convert hex string to integer in Python

Use int function.

int int([x[, base]])
  • If failed to convert, ValueError is raised.

Example:

print int("1f", 16)    # 31
print int("0x1f", 16)  # 31
print int("xxx", 16)   # ValueError is raised
Select default language: