Windows - Need to process quotes in string...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ernesto

    #1

    Windows - Need to process quotes in string...

    I'm trying to use a $ delimeter, but it doesn't seem to work. Here is
    the code:


    launchWithoutCo nsole("devcon.e xe",d'$enable
    "@USB\VID_0403& PID_6010&MI_00\ 7&15E4F68&1&000 0"$)

    I want to send the string parameter:

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

    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,

  • Sybren Stuvel

    #2
    Re: Windows - Need to process quotes in string...

    Ernesto enlightened us with:[color=blue]
    > I'm trying to use a $ delimeter[/color]

    Why?
    [color=blue]
    > I want to send the string parameter:
    >
    > enable "@USB\VID_0403& PID_6010&MI_00\ 7&15E4F68&1&000 0"[/color]

    launchWithoutCo nsole("devcon.e xe"
    'enable "@USB\VID_0403& PID_6010&MI_00\ 7&15E4F68&1&000 0"')

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

    launchWithoutCo nsole("devcon.e xe"
    '''enable "@USB\VID_0403& PID_6010&MI_00\ 7&15E4F68&1&000 0"''')
    [color=blue]
    > The argument itself is a string, but has quotes inside too.[/color]

    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

    Comment

    • Francesco Bochicchio

      #3
      Re: Windows - Need to process quotes in string...

      Il Mon, 31 Oct 2005 07:18:31 -0800, Ernesto ha scritto:
      [color=blue]
      > I'm trying to use a $ delimeter, but it doesn't seem to work. Here is
      > the code:
      >
      >
      > launchWithoutCo nsole("devcon.e xe",d'$enable
      > "@USB\VID_0403& PID_6010&MI_00\ 7&15E4F68&1&000 0"$)
      >
      > I want to send the string parameter:
      >
      > enable "@USB\VID_0403& PID_6010&MI_00\ 7&15E4F68&1&000 0"
      >
      > 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,[/color]

      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&000 0"'

      Ciao
      -----
      FB

      Comment

      • Ernesto

        #4
        Re: Windows - Need to process quotes in string...

        Thanks.

        Comment

        • Tim Roberts

          #5
          Re: Windows - Need to process quotes in string...

          >Ernesto enlightened us with:[color=blue][color=green]
          >>
          >>I'm trying to use a $ delimeter, but it doesn't seem to work. Here is
          >>the code:
          >>
          >>
          >>launchWithout Console("devcon .exe",d'$enable
          >> "@USB\VID_0403& PID_6010&MI_00\ 7&15E4F68&1&000 0"$)[/color][/color]

          Where did you get the idea that this would work? I can't find any
          references to a "customizab le 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.
          [color=blue][color=green]
          >> I want to send the string parameter:
          >>
          >> enable "@USB\VID_0403& PID_6010&MI_00\ 7&15E4F68&1&000 0"[/color][/color]

          Sybren Stuvel <sybrenUSE@YOUR thirdtower.com. imagination> wrote:[color=blue]
          >
          >launchWithoutC onsole("devcon. exe",
          > 'enable "@USB\VID_0403& PID_6010&MI_00\ 7&15E4F68&1&000 0"')[/color]

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

          launchWithoutCo nsole("devcon.e xe",
          'enable "@USB\\VID_0403 &PID_6010&MI_00 \\7&15E4F68&1&0 000"')

          or

          launchWithoutCo nsole("devcon.e xe",
          r'enable "@USB\VID_0403& PID_6010&MI_00\ 7&15E4F68&1&000 0"')

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

          launchWithoutCo nsole("devcon.e xe",
          r'enable "@USB\VID_0403& PID_6010*"')
          --
          - Tim Roberts, timr@probo.com
          Providenza & Boekelheide, Inc.

          Comment

          Working...