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. Advertising

  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. Advertising

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:
    15,432
    Thomas Weidenfeller
    Nov 2, 2004
  2. Karsten W.

    py2exe, command line parameter problem

    Karsten W., Aug 9, 2007, in forum: Python
    Replies:
    0
    Views:
    437
    Karsten W.
    Aug 9, 2007
  3. tarekeldeeb
    Replies:
    4
    Views:
    11,597
    tarekeldeeb
    Mar 10, 2009
  4. curious
    Replies:
    1
    Views:
    279
  5. soren625
    Replies:
    10
    Views:
    263
    Kevin Collins
    Dec 28, 2005
Loading...

Share This Page