From the course: Python Theory for Network Engineers

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Solution: Making your script do repeatable tasks

Solution: Making your script do repeatable tasks - Python Tutorial

From the course: Python Theory for Network Engineers

Solution: Making your script do repeatable tasks

(upbeat music) - [Man] All right, hope that wasn't too bad, because this operation, if you remember, this requires us to have on the Nexus OS device. So in my lab, I only have two devices that are in Nexus. So therefore, my devices are, this is the LAX Core R-1, this is NYC Core R-1. And therefore, my device list would consist of these two devices. Whereas in if you have iOS device, or if you choose to use iOS device from Netmiko, then you could take that block of code, and your device list is list out to be the edge devices within the data center, right? But in this case, I'm using just the Nexus OS. So that is my device list, http, 2.50, 2.60, and the way that I could loop through that device list is the same thing as for device in device list. And remember, indentation matters, right? So, the block of code that we want to execute together all have the same indentation. And for Python, the common practice, I want…

Contents