On 10/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Ciao a tutti,
>
> non uso direttamente python ma lo uso indirettamente da WLST (weblogic
> scripting tool).
>
> Ho un array di bytes da scrivere in un file binario, il codice è il
> seguente:
>
> fileName = 'my.jar'
> bytes = ...
> file = open(fileName, 'wb')
> file.write(String(bytes))
> file.close()
>

Intanto il nome file è un built-in, è meglio non usarlo per una tua
variabile. Quindi chiamalo per esempio output_file
poi qual è lo scopo di quella chiamata a String? che funzione è ? sei
sicuro che sia necessaria?
dovrebbe normalmente bastare

bytes = 'abc'
output_file = open(fileName, 'wb')
output_file.write(bytes)

ciao
francesco
_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a