Op 2005-03-21, [EMAIL PROTECTED] schreef <[EMAIL PROTECTED]>: > 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:
Hex numbers don't exist. You have just numbers. Those numbers can be represented in different ways, but that doesn't make it a different (kind of) number. > for example > > msg = "Length is " > n = '\x81' > msg += n > sock.send(msg) You are not sending a number, you are sending a string. What you seem to want is to represent this number in hexadecimal format on this machine within a string and send that string to an other machine. > 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? Use string formatting: msg = "Length is 0x%x" % n -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list