Python for Network Engineers: What & Why, Data Types

Hello friends and welcome to the first in my blog series of Python for Network Engineers. Today, we will start with the ‘what’ and ‘why’ and some basics of Python to help get you started in your learning journey to becoming a network programmer.


Before we start, you must be equipped with the following to at least understand what I’m talking about. This blog is specifically for learning Python exclusively for the network engineering environment. If that’s where you belong, then this guide can help you.

  • You must already know the basic concepts of programming (i.e., variables, data types, conditionals, loops, methods and functions, etc.)
  • You must already know the basic concepts of computer networking (LAN/WAN, IP addressing, OSI model, etc.)

Why Python for Network Programming?

Python’s standard library has full support for computer networking (i.e., network protocols and other network concepts). It lets you access low level socket support in the underlying operating system, for connection-oriented and connectionless protocols. It also lets you access high level application protocols such as HTTP, FTP, etc.

What Python Can Do

Python scripting covers a wide range of support to computer networks from basic network automation, to enterprise-scale network polling (i.e., graphs for network monitoring). For example, my latest project involves creating a web UI for collecting device logs for Cisco and Juniper routers – all done with Python.

In this basic guide, we will learn all there is to know to start programming for computer networks using Python. Let’s jump start into our first concept, data types.

Python Data Types

In Python, a data type can be mutable or immutable. Mutable means, the value of an object can be changed. Alternatively, immutable means otherwise. It is similar to the concept of variables and constants. However, in Python, when you assign a new value to an existing variable (with immutable data type), rather than the object getting an updated value, a new object is created entirely.

Below is a list of Python Data Types and whether or not they are mutable.

DictionaryFloating-point Numbers
Complex Numbers
Frozen Set
There’s an in depth write up about the different Python Data Types and how they are used in this blog, if you wish to dive deeper.

In the next post, we will learn to use and manipulate String in Python. This is an important topic as majority of your time in network programming will be working with strings. I’ll see you again soon!