By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,551 Members | 1,159 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,551 IT Pros & Developers. It's quick & easy.

Windows - Need to process quotes in string...

P: n/a
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 "$)

I want to send the string parameter:

enable "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&0000 "

to the program devcon.

The argument itself is a string, but has quotes inside too. I've tried
it many different ways and I keep getting syntax errors.

Thanks,

Oct 31 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Ernesto enlightened us with:
I'm trying to use a $ delimeter
Why?
I want to send the string parameter:

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

Or, if you should also be able to send single quotes:

launchWithoutConsole("devcon.exe"
'''enable "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&0000"''' )
The argument itself is a string, but has quotes inside too.


Then use other quotes as string delimiters. Why would you use
something else?

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Oct 31 '05 #2

P: n/a
Il Mon, 31 Oct 2005 07:18:31 -0800, Ernesto ha scritto:
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 "$)

I want to send the string parameter:

enable "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&0000 "

to the program devcon.

The argument itself is a string, but has quotes inside too. I've tried
it many different ways and I keep getting syntax errors.

Thanks,


Use the single quote to delimit the string, so you can use the double
quote inside it. Like this:

'enable "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&0000 "'

Ciao
-----
FB
Oct 31 '05 #3

P: n/a
Thanks.

Nov 2 '05 #4

P: n/a
>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 <sy*******@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, ti**@probo.com
Providenza & Boekelheide, Inc.
Nov 3 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.