Technology / Programming / Python

Little known tricks in using Python argparse

Python programmer

I am a Perl expert. Hence, I have used Perl’s Getopt::Long module for ages.

Around 2 years back, my org decided to use Python. As I started developing tools & automation in Python, I wanted a Python module that provides similar functionality to Perl’s Getopt::Long.

Since I was looking for something similar, I found Python’s getopt module. But, it is very limited in its functionality and non-intuitive. Using it results in too much unnecessary code.

Thankfully, the documentation of getopt starts with a “note” asking the reader to consider argparse module. …

Kamal Raj Guptha R

“I am Abundantly Blessed. Thank You God. Life is Fantastic.” — about me; also a Bibliophagist, Life Coach, Triathlete, Software Builder, Cloud Architect.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store