Hi Seb Please don't kick me for this Q :D I need to write to write the data like maya binary .
With this code also if we open the bin file in word pad or some editor we can see hello there. Instead of that i need some drau�...@¼!¯c letters :D Is there any way to achieve this ?? Kur On Wed, Apr 1, 2009 at 10:20 AM, Sebastian Schoellhammer < [email protected]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---
