Windows - Need to process quotes in string...

Tim Roberts timr at probo.com
Thu Nov 3 01:41:06 EST 2005


>Ernesto enlightened us with:
>>
>>I'm trying to use a $ delimeter, but it doesn't seem to work.  Here is
>>the code:
>>
>>
>>launchWithoutConsole("devcon.exe",d'$enable
>>  "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&0000"$)

Where did you get the idea that this would work?  I can't find any
references to a "customizable string delimiter" in any Python up through
2.4.2.  I recall it being proposed at one point, but I don't think it was
ever seriously considered.
 
>> I want to send the string parameter:
>>
>> enable "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&0000"

Sybren Stuvel <sybrenUSE at YOURthirdtower.com.imagination> wrote:
>
>launchWithoutConsole("devcon.exe",
>    'enable "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&0000"')

This is not correct.  It might accidentally work because \V is not a
defined escape sequence, but the right answer is either:

launchWithoutConsole("devcon.exe",
    'enable "@USB\\VID_0403&PID_6010&MI_00\\7&15E4F68&1&0000"')

or

launchWithoutConsole("devcon.exe",
    r'enable "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&0000"')

However, devcon.exe supports regular expressions, and is forgiving about
syntax.  If you have only one such device, you could use:

launchWithoutConsole("devcon.exe",
    r'enable "@USB\VID_0403&PID_6010*"')
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list