hex sending

Paul Rubin http
Thu Oct 5 03:46:10 EDT 2006


"hiroc" <hiroc13 at hotmail.com> writes:
> s.send("abc") # send test string
> I need to send hex:"10 06 00 0f 02 bc d1" instead of "abc"

See the binascii module:

   import binascii

   # a2b_hex stands for "ascii to binary conversion, hex format"
   # you must remove the spaces
   binary = binascii.a2b_hex ("1006000f02bcd1")

   s.send (binary)



More information about the Python-list mailing list