January 2019
Beginner to intermediate
776 pages
19h 58m
English
As the final step, let's put everything you have learned so far about Pexpect into a script. Putting code into a script makes it easier to use in a production environment, as well as easier to share with your colleagues. We will write our second script, chapter5_2.py.
Refer to the following code:
#!/usr/bin/python3 import getpass from pexpect import pxssh devices = {'iosv-1': {'prompt': 'iosv-1#', 'ip': '172.16.1.20'}, 'iosv-2': {'prompt': 'iosv-2#', 'ip': '172.16.1.21'}} commands = ['term length ...Read now
Unlock full access