writing in a file as binary mode????

Dennis Lee Bieber wlfraed at ix.netcom.com
Mon Sep 23 20:35:34 EDT 2002


jubafre at brturbo.com fed this fish to the penguins on Monday 23 
September 2002 12:40 pm:

> i open the a file for writing in a binary mode, but doesnt work
> 
> final3=['0020 0000x9', '0030 0000xa', '00B4 0000x8', '0030 0000xb',
> '00F0', '0001', '0003', '0005'] destino=raw_input("Digite o nome do

        Pardon the KNode garbage wrapping...

        All those are just character strings, not binary data.

        First step would be to make that data binary...

        ... = [ 0x0020, 0x0000, 0x0030, ... 0x0005 ]


> arquivo .mem: ") f = open(destino,'wb')
> f.write('\x03AHM ')
> for i in final3:
>     f.write(i+' ')

        You won't be able to concatenate a space to what is now integer binary.



--
 > ============================================================== <
 >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
 >      wulfraed at dm.net     |       Bestiaria Support Staff       <
 > ============================================================== <
 >        Bestiaria Home Page: http://www.beastie.dm.net/         <
 >            Home Page: http://www.dm.net/~wulfraed/             <



More information about the Python-list mailing list