Write an hexadecimal file
Larry Bates
lbates at syscononline.com
Wed Mar 30 12:31:12 EST 2005
There is not such thing as a hexadecimal file. Files are either
binary or text. Hexadecimal is a representation of binary data
where 4 bits are displayed as a single hex digit (0-F) as
shorthand (because 1111000001111000111 is just too difficult to
deal with).
To write binary data to a file in Python you open the file with
"wb" mode.
Example:
fp=open('myfile.dat', 'wb')
fp.write(bytes)
fp.close()
>From your post I cannot tell anything more about what you are
actually doing, so I hope this helps.
Larry Bates
Cesar Andres Roldan Garcia wrote:
> Hi
>
> I'm trying to write an hexadecimal file... I mean not a text plain...
> I have to convert a float decimal number in float hexadecimal one, and
> that's done.
>
> That number is the one I'm gonna write in the hex file... can anybody
> help me 'cause i don't know how python write an hex file!
>
> Thanks!
>
More information about the Python-list
mailing list