blanks embedded in python 2.3 optparse

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

    blanks embedded in python 2.3 optparse

    Hi

    is there a way to pass a param with blank embedded with optparse ?
    (C:\Python23\Do c\lib\module-optparse.html)


    for instance
    prog --name=mr jones


    and have "mister jones" as a single entry for name ?

    reading the docs I see nothing about that.

    the only thing is the nargs to pass nargs at a time, but here you can't tell
    in advance how many words in the name there is

    thanks




  • Karl Scalet

    #2
    Re: blanks embedded in python 2.3 optparse

    pascal barbedor schrieb:[color=blue]
    > Hi
    >
    > is there a way to pass a param with blank embedded with optparse ?
    > (C:\Python23\Do c\lib\module-optparse.html)
    >
    >
    > for instance
    > prog --name=mr jones
    >[/color]

    you need to quote the name like
    prog --name="mr jones"

    That should work

    Karl

    Comment

    • pascal barbedor

      #3
      Re: blanks embedded in python 2.3 optparse

      [color=blue]
      > you need to quote the name like
      > prog --name="mr jones"
      >
      > That should work
      >
      > Karl
      >[/color]


      it works thanks


      Comment

      • Nagy László Zsolt

        #4
        Re: blanks embedded in python 2.3 optparse

        >[color=blue]
        >
        >is there a way to pass a param with blank embedded with optparse ?
        >(C:\Python23\D oc\lib\module-optparse.html)
        >
        >
        >for instance
        >prog --name=mr jones
        >
        >
        >and have "mister jones" as a single entry for name ?
        >
        >reading the docs I see nothing about that.
        >
        >the only thing is the nargs to pass nargs at a time, but here you can't tell
        >in advance how many words in the name there is
        >
        >[/color]

        For Unix and windows:

        prog --name="mr jones"

        For unices, this should work too:

        prog --name=mr\ jones

        Know nothing about macs and others.

        Laci



        Comment

        Working...