Python : Convert from C-Char to Int
Posted
by cuband
on Stack Overflow
See other posts from Stack Overflow
or by cuband
Published on 2010-05-27T15:27:07Z
Indexed on
2010/05/27
15:31 UTC
Read the original article
Hit count: 152
python
I have a string read in from a binary file that is unpacked using struct.unpack
as a string of length n.
Each byte in the string is a single integer (1-byte) representing 0-255. So for each character in the string I want to convert it to an integer.
I can't figure out how to do this. Using ord doesn't seem to be on the right track...
© Stack Overflow or respective owner