Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (1.6k points)

I noticed that the Python 2.7 documentation includes yet another command-line parsing module. In addition to getopt and optparse we now have argparse.

Why has yet another command-line parsing module been created? Why should I use it instead of optparse? Are there new features that I should know about?

1 Answer

0 votes
by (10.9k points)

As per official Python document, optparse module is deprecated and they have stopped the development for this module.

There are various advantages that argparse have over optparse some of them are:

1. It is a flexible and powerful library for command-line parsing .

2. It allows prefixes like ‘+’ etc.

3. Handles positional arguments

4. It allows sub-commands

5. It has a much simpler interface for custom types and action.

 You can get more details about argparse here:

Related questions

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.5k answers


108k users

Browse Categories