From the course: Network Automation Quick Start

Unlock this course with a free trial

Join today to access over 22,500 courses taught by industry experts.

Telnet script creation

Telnet script creation

- [Instructor] Now for this initial script, I'm gonna do the editing directly in the Network Automation container. LS shows us that we have no files on the Network Automation container. I'll create a file called Python31.py and I'll paste the script from the Python website into the Network Automation container. One of the advantages of using Python over other programming languages is all the modules and additional code that you can leverage. So rather than writing everything yourself, you can simply import libraries, such as the Telnet library into your Python script. So in this example, we're gonna import getpass. We're gonna leverage that here by asking the user to enter their password. Rather than storing the password in the script, we're going to ask the user to enter their password and then save that in what's called a variable. A variable is a placeholder that can change in value. So as an example, I could enter a password of cisco. You might enter a different password in your…

Contents