Linked Questions
81 questions linked to/from Convert hex string to integer in Python
197
votes
3
answers
540k
views
How do I convert hex to decimal in Python? [duplicate]
I have some Perl code where the hex() function converts hex data to decimal. How can I do it on Python?
42
votes
5
answers
62k
views
how to parse hex or decimal int in Python [duplicate]
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 "-298" is in base 10.
How do I ...
10
votes
1
answer
129k
views
How to convert string to hex in Python? [duplicate]
I using the pyqt5 line edit box as my input boxes. I want to take the input from the input boxes and convert it from string to hex to send to serial capture. For example I did this but I didn't ...
2
votes
3
answers
5k
views
Python: How to change hex string int integer? [duplicate]
Possible Duplicate:
Convert hex string to int in Python
Hello, I want to use some string like "0xFF123456" as a 32-bit unsigned integer.
Please give me some advice.
Thanks.
-1
votes
2
answers
9k
views
Convert string array into integer python [duplicate]
I need to convert following string array into integers. How to do it in python.
Those string are hex values.
['02', '01', '03', '01', '04', '01', '05', '01', '06', '01', '07', '01', '08', '01', '09', ...
1
vote
2
answers
8k
views
Writing a function to convert hex to decimal [duplicate]
I need to write a function that converts hex to decimal and I've got an idea of how to do it but I'm stuck at the first bit. So far I am taking the user input and returning it in hex, but this only ...
-1
votes
1
answer
9k
views
Converting an HEX to unsigned INT16 in python [duplicate]
I've been struggling for a while doing that and can not find the right way to do it.
I have a HEX
8a:01
which is the unsigned INT16
394
How can I do that in python 3.X ?
Thanks in advance
0
votes
7
answers
3k
views
python hex to decimal using for loop [duplicate]
import math
def hexToDec(hexi):
result = 0
for i in range(len(hexi)-1,-1,-1):
if hexi[i] == 'A':
result = result + (10 * math.pow(16,i))
elif hexi[i] == 'B':
...
-1
votes
1
answer
1k
views
Converting a list of strings that represent hex values into actual hex values [duplicate]
So, I have a list containing strings that represent hex values like:
['02', 'ff', '98', '80', '39', '31', '03']
I would like to generate a new list that contains the actual hex values like:
[0x02, ...
-2
votes
1
answer
969
views
How can you convert a variable into denary in Python? [duplicate]
I have had problems with converting strings (like inputs) into denary, as a string is a necessary for using hexadecimal (as it can't be stored as an integer because of the characters a-f being ...
-1
votes
1
answer
872
views
How to convert a hexadecimal string into a hexadecimal value? [duplicate]
I have been trying to convert a hexadecimal string into a hexadecimal value in Python just as you can convert a string containing an integer into an integer value. I have tried the following
>>...
0
votes
1
answer
349
views
Converting to Hex in Python [duplicate]
I know this may be an incredibly easy answer but I couldn't find the answer to this so is there an easy way to convert between hex and decimal and binary and hex in python like the way you can convert ...
0
votes
0
answers
320
views
How could I convert a Unicode String input to a hex value in python? [duplicate]
I have a input JSON file which include data with String like "Address": "0x33". I would like to use this data to open my raw data file and seek to the file location.
infile.seek(0x30,0)
How could I ...
0
votes
1
answer
286
views
Python - Converting raw hex to type 'int' [duplicate]
I have raw hex from a com port that I want to represent as a hex value that I can use later for bitwise operations.
For example, I have 1035 and I want it as 0x1035.
I am relatively certain the hex()...
-3
votes
1
answer
179
views
How to subtract string hexadecimal values from dictionaries? [duplicate]
There are two dictionaries (d1 and d2) formed after combining list values. I have to subtract the values (d2-d1) and print the dictionary.
d1 = {'Rash': '80000000', 'Kil': '80000020', 'Varsha': '...