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 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 books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.