Introduction to Python

Python is one of the most popular programming languages in the world. It is free and open-source. Python is developed by Guido van Rossum in the late 1980s and named not after the snake but after the television show “Monty Python”.

The syntax of Python is simple, which makes it easy to read and write code, even if you’ve programmed anything before.  Python runs on an interactive interpreter, which means that you can execute code right away, you don’t have to compile your code before you can run it.

All major platforms are supported, including Windows, macOS, and Linux. There is an active user community, and there are thousands of packages you can use.

Python Usage

Let me start with some examples for those of us who are interested in Python for anything network-related:

  • Scripting: Do you have any repetitive tasks that could be automated? Write a Python script to do it for you.
  • Interact with network devices: You can connect with your network devices through SSH or the API to configure the device or to fetch information from it.
  • Embedded Applications: You can use MicroPython on IoT devices.

You can also use Python for:

  • Web development: With the Django or Flask framework, you can build websites. Some big websites that use Django are NASA, Instagram, and Bitbucket.
  • Machine learning: Create programs that can automatically learn and improve.
  • Data analysis: Analyze data and create visualizations with charts.
  • Games: You can create games in Python.
  • Desktop applications: It’s possible to create GUI applications.

How to learn Python

If you want, there is a lot to learn about Python. However, someone who intends to use Python to build a website or to create games is going to use Python in a different way than someone who wants to use it for network automation.

In the Python course, I explain the basics of Python to get you started as quickly as possible. It should take a couple of hours to go through. Once you understand the basics, you can dive into specifics for your work field. For example, learning how to use SSH and REST APIs in Python.

The examples I provide are with “networking” in mind. Instead of strings like “hello world”, I’ll use examples with hostnames or sentences you might encounter when working with network devices.

If you are new to programming, it can be difficult to see the “big picture”. Don’t worry about this for now. Focus on understanding the syntax and how the different components of Python work. At the end of the course, we’ll look at some examples where we use all the different bits and pieces together to create an actual script that connects to a router and retrieves information.

Within the lessons, I added links to other Python lessons. I suggest going through the course from start to finish. When you have completed the course, the links can be useful as reference material.


Forum Replies

  1. Hi Rene,

    Will like to bring to your attention. When we use search box for “Python” lessons it shows “no results” found. But however under CCNP and CCIE course, if we manually search its available.

    On other Note in CCIE Introduction page their is an typo in certification spelling .

    Regards,
    Abrar

  2. Hi Abrar,

    Thanks for letting me know, that is interesting. We are replacing the search engine soon, I’ll make sure it will also work for partial matches.

    Rene

  3. Hi,
    Can you explain me what is Jinja and how it works?

    Here I saw that it is a template designer tool, but I’m not sure to understand what it is meaning and how we can use it for our network automation scripts.

    Thanks

  4. Hello Naveen

    Whenever you want to communicate with a particular entity, it’s always a good idea to check the related API documentation. For EVE-NG, you can take a look at the following link:

    https://www.eve-ng.net/index.php/documentation/howtos/how-to-eve-ng-api/

    Here you should find all you need to interface with the virtual devices in the emulator. In the examples, you will find that they use CURL, a simple Linux CLI tool to communicate through HTTP. You can also find some examples for what you need to use the EVE-NG API at the following lesson, but for t

    ... Continue reading in our forum

8 more replies! Ask a question or join the discussion by visiting our Community Forum