Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

argparse missing in python 3


does somebody know, why the argparse module didn't make it in python 3? it's new in python 2.7, but the 2.x branch is running out with 2.7. it makes no sense to me not to support it in the actual python 3 branch.

like image 298
greenDragon Avatar asked Sep 28 '10 22:09

greenDragon


People also ask

Does Argparse come with Python?

The Python argparse library was released as part of the standard library with Python 3.2 on February the 20th, 2011. It was introduced with Python Enhancement Proposal 389 and is now the standard way to create a CLI in Python, both in 2.7 and 3.2+ versions.

Where do you put Argparse pythons?

It's fine to put the import argparse within the if __name__ == '__main__' block if argparse is only referred to within that block.

Why we import Argparse in Python?

The argparse module makes it easy to write user-friendly command-line interfaces. The program defines what arguments it requires, and argparse will figure out how to parse those out of sys.argv . The argparse module also automatically generates help and usage messages.

What is Argparse module in Python?

The argparse module in Python helps create a program in a command-line-environment in a way that appears not only easy to code but also improves interaction. The argparse module also automatically generates help and usage messages and issues errors when users give the program invalid arguments.


2 Answers

It will be in Python 3.2. It was just added in Python 2.7, which was released just this July; Python 3.2 will be the next 3.x release after that date.

like image 141
kindall Avatar answered Oct 10 '22 15:10

kindall


argparse is in Python 3, 3.2 to be specific. See also: http://www.python.org/dev/peps/pep-0389/

like image 21
Jim Brissom Avatar answered Oct 10 '22 16:10

Jim Brissom