Hello,
if you want to read/write binary in python look up the "struct" module -
heres an example:
import struct
f = open("c:/test.bin", "wb")
f.write(struct.pack("5s","hello"))
f.write(struct.pack("i",7))
f.close()
f = open("c:/test.bin", "rb")
print struct.unpack("5s",f.read(5))[0]
print struct.unpack("i",f.read(struct.calcsize("i")))[0]
f.close()
hope this helps,
seb
On Wed, Apr 1, 2009 at 1:01 PM, Achayan <[email protected]> wrote:
>
> Hi All
>
> I have question , just trying to write some data to file with python .
> but i need to write the data in binary format.
>
> like i want to write "Hello world" in binary format . And i want to
> read it also . I dont have any idea about binary data
>
> Any one have some Idea about this ??
>
> Thanks
> >
>
--
Sebastian Schoellhammer
Sr. Technical Artist
Square Enix LTD
www.square-enix.com
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---