-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Python Network Programming Techniques
By :
So far, we have only written scripts that ran each of the instructions linearly one after another. But quite often, we want to change the behavior of our script based on the value of a variable. Let's say, for example, that we want to write a script that asks the user what kind of device—a user device or an infrastructure device—they want to configure. Our script then returns an IP address with a pre-defined network part and a user-defined host part.
In this recipe, you will see how to create such a basic IP address management tool if clause.
Open your code editor and start by creating a file called if_conditions.py. Next, navigate your terminal to the same directory in which you just created the if_conditions.py file.
In this recipe, we will create a list of user and infrastructure devices, check what kind of device the user wants to retrieve, and then...