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 ...

Get Python Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.