soluzione trovata: file = open(fileName, 'wb') for entry in bytes: file.write(struct.pack('b', entry)) file.close()
e verifica del file prodotto: jar tvf /products/.../DummyEvent-sbconfig.jar 23728 Mon Oct 01 15:49:26 CEST 2007 ExportInfo 264 Mon Oct 01 15:49:26 CEST 2007 EventBus-DummyEvent/providers/Provider2/_folderdata.LocationData 11553 Mon Oct 01 15:49:26 CEST 2007 EventBus-DummyEvent/providers/Provider2/DummyEvent-Provider2-SingleXMLFileProvid.ProxyService 686 Mon Oct 01 15:49:26 CEST 2007 EventBus-DummyEvent/consumers/Consumer1/resource/DummyEvent-Consumer1-ConsumerEventTransf.Xquery ... ciao ferp -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Francesco Guerrieri Sent: lunedì, 1. ottobre 2007 15:31 To: Discussioni generali sul linguaggio Python Subject: Re: [Python] Come scrivere un array di bytes in un file binario On 10/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > provato ma: > > cat my.jar > array([80, 75, 3, 4, 20, 0, 8, 0, 8, 0, -111, 121, 65, 55, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 10, 0, ...., 0, 0, 0], byte) Questo vuol dire che str(bytes) ha quella rappresentazione. Cosa ti aspettavi invece? Potresti provare a usare output_file.write(repr(bytes)) ciao francesco _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python IMPORTANT: This e-mail transmission is intended for the named addressee(s)only. Its contents are private, confidential and protected from disclosure and should not be read, copied or disclosed by any other person. If you are not the intended recipient, we kindly ask you to notify the sender immediately by telephone (+41 (0)58 806 50 00), to redirect the message to the account "[EMAIL PROTECTED]" and to delete this e-mail. E-mail transmissions may be intercepted, altered or read by unauthorized persons and may contain viruses. Therefore, it is recommended that you use regular mail or courier services for any information intended to be confidential. However, by sending us messages through e-mail, you authorize and instruct us to correspond by e-mail in the relevant matter. Thank you. _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python