Thank you Parsad.
I am using Python 2.7.1+
You are right, looks like optparse is replaced by argparse.
My problem was that I was checking output and not options.output.
cheers,
Mina
On 11-09-20 02:27 PM, Prasad, Ramit wrote:
from optparse import OptionParser
I am not sure what version of Python you are using but from 2.7+ optparse is
deprercated. You may want to use that if you can.
I don't really understand what dest and action in the arguments to
parser.add_option mean.
Here is your usage:
parser = OptionParser(usage="blahblahblah")
parser.add_option("-f", "--file", dest="filename")
<Option at 0x8332eb8: -f/--file>
(options, args) = parser.parse_args(['-f filename.csv']) # test in interpreter
options.filename
' filename.csv' # Note the space before filename
print options.filename
filename.csv
See the documentation: http://docs.python.org/library/optparse.html
Ramit
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor