Check out the 'struct' module, this allows you to read and write binary strings. eg...
eg. >>> from struct import pack, unpack >>> delim = ':' >>> code = 'U' >>> x = 14 >>> y = 12 >>> data = pack('cchh', delim, code, x, y) >>> data ':U\x0e\x00\x0c\x00' >> >>> d, c, x, y = unpack('cchh', data) >>> d ':' >>> c 'U' >>> x 14 >>> y 12 Matthew Sherborne ----- Original Message ----- From: "Srividya Visweswarababu" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 16, 2002 3:00 PM Subject: Serial Port Communication > Hi, > > I am using the pySerial module to talk to one of the > devices connected to my RS232 port. When i issue some > command through that module: > > >>> ser.write("#50 MDMODE") > >>> ser.inWaiting() > 4L > >>> ser.read(4) > '\x12\xb4\xfc\t' > > ->It seems like I am getting the output in hex format. > Is there a way to read them? Or get the output in > normal wordS? > > Thanks in advance, > --V. > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax > http://taxes.yahoo.com/ > _______________________________________________ > ActivePython mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs