About 50 results
Open links in new tab
  1. Convert hex string to integer in Python - Stack Overflow

    Jul 30, 2022 · 59 Convert hex string to int in Python I may have it as "0xffff" or just "ffff". To convert a string to an int, pass the string to int along with the base you are converting from. Both strings will …

  2. python - How to convert an int to a hex string? - Stack Overflow

    Also you can convert any number in any base to hex. Use this one line code here it's easy and simple to use: hex(int(n,x)).replace("0x","") You have a string n that is your number and x the base of that …

  3. how to parse hex or decimal int in Python - Stack Overflow

    Oct 28, 2013 · Closed 9 years ago. I have a string that can be a hex number prefixed with "0x" or a decimal number without a special prefix except for possibly a minus sign. "0x123" is in base 16 and " …

  4. Hex string to signed int in Python - Stack Overflow

    How do I convert a hex string to a signed int in Python 3? The best I can come up with is

  5. How to use hex() without 0x in Python? - Stack Overflow

    May 7, 2013 · Besides going through string formatting, it is interesting to have in mind that when working with numbers and their hexadecimal representation we usually are dealing with byte-content, and …

  6. python - Decorating Hex function to pad zeros - Stack Overflow

    Sep 28, 2012 · 5 If you want to hold the preceding hex notation 0x you can also try this method too which is using the python3 f-strings.

  7. convert pandas dataframe column from hex string to int

    Jun 22, 2016 · I have a very large dataframe that I would like to avoid iterating through every single row and want to convert the entire column from hex string to int. It doesn't process the string correctly …

  8. python - Check if a string is hexadecimal - Stack Overflow

    Jul 21, 2012 · So I need to do a if hex control. I am using Python 2.6.5. UPDATE: The reason of that problem is, (somehow) messages I sent are received as hex while messages sent by operator (info …

  9. Python hex to string? - Stack Overflow

    Feb 10, 2015 · >>> hex(0xb0f4735701d6325fd072) '0xb0f4735701d6325fd072L' (You can strip the L from the string with hex(0xb0f4735701d6325fd072).strip('L')) To convert back to a long from the …

  10. How do I convert hex to decimal in Python? - Stack Overflow

    Feb 9, 2012 · I have some Perl code where the hex() function converts hex data to decimal. How can I do it on Python?