Sending hex number as is

knguyen at megisto.com knguyen at megisto.com
Mon Mar 21 15:25:23 EST 2005


This question may be ased before, but I couldn't find the answer
searching the archive.

Basically, I just want to send a hex number from one machine to the
next:

for example

msg = "Length is "
n = '\x81'
msg += n
sock.send(msg)

The problem is n's value is not fixed. For example,

msg = "Length is "
n = len(somestring)
msg += n  # This won't work of course, since n is int

How do I send this msg + n?

Thanks,
Khoa




More information about the Python-list mailing list