Escapes???

Dave Hansen dhansen at cyberoptics.com
Fri Jun 2 18:36:07 EDT 2000


On 2 Jun 2000 15:22:43 GMT, aahz at netcom.com (Aahz Maruch) wrote:

>In article <8h87u1$sga$1 at news2atm.raleigh.ibm.com>,
>Arinté <shouldbe at message.com> wrote:
>>
>>I am trying to write this escape seq to a device from python
>>"H\x1b\x23\x12art\x1b\x23\x01\n"
>>The \x1b\x23\x12 is supposed to be a command tell the device to do something
>>special with "art", but python is making it look like this \x1b\x23\x12a
>>"rt".  Am I missing something on how to work with escape sequences?  Is
>>there another way to write hex values in a string.  I rather us \x00 because
>>that is what are testers are familiar with.
>
>I'd like to see some of the actual code.  Firing up the Python
>interpreter produces correct resulte for me.

I didn't post the original question, but here's what I get
interactively:

   >>> t = "H\x1ba"
   >>> for c in t: print "%x" % ord(c)
   ...
   48
   ba
   >>> t = "H\x1b" "a"
   >>> for c in t: print "%x" % ord(c)
   ...
   48
   1b
   61
   >>>

Regards,

                              -=Dave
-- 
The opinions expressed in this post are my own and do not 
represent the views of CyberOptics Corporation.
Change is inevitable.  Except from a vending machine.



More information about the Python-list mailing list