Skip to Main Content
Python Programming Blueprints
book

Python Programming Blueprints

by Daniel Furtado, Marcus Pennington
February 2018
Intermediate to advanced content levelIntermediate to advanced
456 pages
9h 56m
English
Packt Publishing
Content preview from Python Programming Blueprints

Creating the command line parser

Perfect! Now, we are all set to create the command line parser. Let's go ahead and create a file called cmdline_parser.py in the currency_converter/currency_converter/core directory and as usual, let's start importing everything we need:

import sysfrom argparse import ArgumentParserfrom .actions import UpdateForeignerExchangeRatesfrom .actions import SetBaseCurrencyfrom .currency import Currency

From the top, we import sys, so that can we exit the program if something is not right. We also include the ArgumentParser so we can create the parser; we also import the UpdateforeignerExchangeRates and SetBaseCurrency actions that we just created. The last thing in the Currency enumeration is that we are going to ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Intelligent Projects Using Python

Intelligent Projects Using Python

Santanu Pattanayak, Manohar Swamynathan
Flask Blueprints

Flask Blueprints

Joël Perras
Matplotlib for Python Developers - Second Edition

Matplotlib for Python Developers - Second Edition

Aldrin Yim, Claire Chung, Allen Yu

Publisher Resources

ISBN: 9781786468161Supplemental Content