process command line parameter

Discussion in 'Python' started by asit, Jan 17, 2009.

  1. asit

    asit Guest

    Recently I was coding a link extractor. It's a command line stuff and
    takes parameter as argument.
    I found that the in operator is not always helpful.
    eg. if "--all" in sys.argv:
    print "all links will be printed"

    its not helpful when some attribute value is sent in command line
    parameter.
    hence I want to process some data like find=".co.uk"

    How can i do this ???
     
    asit, Jan 17, 2009
    #1
    1. Advertisements

  2. * asit (Sat, 17 Jan 2009 13:28:12 -0800 (PST))
    > Recently I was coding a link extractor. It's a command line stuff and
    > takes parameter as argument.
    > I found that the in operator is not always helpful.
    > eg. if "--all" in sys.argv:
    > print "all links will be printed"
    >
    > its not helpful when some attribute value is sent in command line
    > parameter.
    > hence I want to process some data like find=".co.uk"
    >
    > How can i do this ???


    Use optparse
     
    Thorsten Kampe, Jan 18, 2009
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Will
    Replies:
    1
    Views:
    16,096
    Thomas Weidenfeller
    Nov 2, 2004
  2. Replies:
    8
    Views:
    560
    Fabio Fracassi
    May 4, 2005
  3. Karsten W.

    py2exe, command line parameter problem

    Karsten W., Aug 9, 2007, in forum: Python
    Replies:
    0
    Views:
    525
    Karsten W.
    Aug 9, 2007
  4. tarekeldeeb
    Replies:
    4
    Views:
    16,334
    tarekeldeeb
    Mar 10, 2009
  5. Giampaolo Rodola'
    Replies:
    2
    Views:
    412
    Giampaolo Rodola'
    Jun 12, 2009
  6. Vandana

    command line options for child process

    Vandana, Feb 18, 2010, in forum: C Programming
    Replies:
    1
    Views:
    995
    Eric Sosman
    Feb 18, 2010
  7. curious
    Replies:
    1
    Views:
    362
  8. soren625
    Replies:
    10
    Views:
    550
    Kevin Collins
    Dec 28, 2005
Loading...