Book Image

Daniel Arbuckle's Mastering Python

By : Daniel Arbuckle
Book Image

Daniel Arbuckle's Mastering Python

By: Daniel Arbuckle

Overview of this book

Daniel Arbuckle's Mastering Python covers the basics of operating in a Python development environment, before moving on to more advanced topics. Daniel presents you with real-world solutions to Python 3.6 and advanced-level concepts, such as reactive programming, microservices, ctypes, and Cython tools. You don't need to be familiar with the Python language to use this book, as Daniel starts with a Python primer. Throughout, Daniel highlights the major aspects of managing your Python development environment, shows you how to handle parallel computation, and helps you to master asynchronous I/O with Python 3.6 to improve performance. Finally, Daniel will teach you the secrets of metaprogramming and unit testing in Python, helping you acquire the perfect skillset to be a Python expert. Daniel will get you up to speed on everything from basic programming practices to high-end tools and techniques, things that will help set you apart as a successful Python programmer.
Table of Contents (13 chapters)

Handling command-line arguments with argparse

In this section, we'll see how to make the program read data from its command line, a common feature for programs of all sorts. Most command-line programs and a surprising number of graphical user interface programs as well can be given extra information on the command line, after the command that invokes the program. These extra bits of information are referred to as arguments and they are delivered to Python programs as a list of strings. It turns out that there's quite a lot of code involved in turning an argument list into useful information, especially, if we want to make the program as convenient for our users as possible. Fortunately, a lot of that code can be the same from program to program, and the Python standard library's argparse module takes care of much of the effort for us.

...