Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/08/2013, 20:28
Avatar de razpeitia
razpeitia
Moderador
 
Fecha de Ingreso: marzo-2005
Ubicación: Monterrey, México
Mensajes: 7.321
Antigüedad: 19 años, 2 meses
Puntos: 1360
Respuesta: Escribir serie de bytes.

Puedes hacer algo así:

Código Python:
Ver original
  1. def to_bytearray(some_int):
  2.     x = hex(some_int)[2:]
  3.     if len(x) % 2 == 1:
  4.         x = '0' + x
  5.     return bytearray.fromhex(x)