Monthly Archives: May 2016

Try except

Sometimes code throws an exception. You can catch that exception using the try-except block. The try-except statement starts with a block of code, and a response is specified in case an exception is thrown. Note: In other programming languages this is often called try-catch.   Related Course: Try-except example Lets say we want to get […]

Expanded For Loop

What is an expanded for loop? We’ve seen simple numerical for loops before. For numerical lists these type of for loops well. What if we use a dictionary? a dictionary can also be used in a loop too! Related Courses Expanded For Loop Given a dictionary with a one to one mapping we simply iterate […]

Line charts

Python Courses Complete Python Bootcamp: Go from zero to hero in Python Complete Python Web Course: Build 8 Python Web Apps Line chart You can use Matplotlib to create a line chart with Python. Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension numpy.  This takes only a few […]

Read File

Reading files is straightforward: Python has built in support for reading and writing files. The function readlines() can be used to read the entire files contents. Related Courses Read file into list We call the function method open to read the file, then we call the method readlines() to read all of the file contents […]

Command line arguments

What are command line arguments in python? In the command line, we can start a program with additional arguments. These arguments are passed into the program. Python programs can start with command line arguments. For example: $ python image.bmp where and image.bmp is are arguments. (the program is Python) Related Course: How to […]

Socket Server

Do you want to make a socket server app? A server can be created using the module socket. If you make a socket server, you can define your own application protocol. You can also use it to work with existing apps. Related Courses Complete Python Bootcamp: Go from zero to hero in Python Python for […]


The argsparse module can be used to parse command line arguments. This article is written for argsparse with Python 3. Sure you could write your own parser to get command line arguments from sys.argv, but argparse makes it easier. By default it will add a help option, even if you don’t specify it. Let’s show […]