0

I'd like to use option parser to print the result of a computation to the command line. So far, I have

parser = OptionParser()
parser.add_option('-s','--some', help = "Print some of the Suspects")
parser.add_option('-a','--all',help = "Print all of the Suspects")

(opts,args) = parser.parse_args()

If the user passes -s, I would like the first 25 rows of a dataframe to be printed (I know how to do this). If -a is passed, I would like the entire dataframe to be printed. What do I have left to do?

user3600497
  • 1,621
  • 1
  • 18
  • 22
  • 2
    `optparse` is deprecated in favour of `argparse`. And what do you have left to do? Write your program to print your dataframes of course. Can you be a bit more specific as of why you have a problem with parsing arguments? – roeland Nov 16 '15 at 21:26

1 Answers1

1
from optparse import OptionParser

parser = OptionParser()
parser.add_option('-s','--some', help = "Print some of the Suspects")
parser.add_option('-a','--all',help = "Print all of the Suspects")

(opts,args) = parser.parse_args()

if opts.some:
    print "some results"
if opts.all:
    print "all results"
furas
  • 134,197
  • 12
  • 106
  • 148