Converting Hex to decimal
Miki Tebeka
miki.tebeka at zoran.com
Wed Jun 2 05:25:48 EDT 2004
Hello Dean,
> Each hex character is 8 bits. I would like to convert one byte at the
> time and pipe the converted data into a new file.
This is not tested but should be in the lines of what you're trying to
do:
from array import array
a = array("B")
a.fromstring(open("input_file", "rb").read()) # Read all file
out = open("output_file", "wb")
for bit in a:
new_bit = convert(bit)
out.write(new_bit)
HTH.
--
-------------------------------------------------------------------------
Miki Tebeka <miki.tebeka at zoran.com>
http://tebeka.web1000.com
The only difference between children and adults is the price of the toys.
More information about the Python-list
mailing list