Network Automation using Python 3: An Administrator's Handbook by Jithin Alex

Network Automation using Python 3: An Administrator's Handbook by Jithin Alex

Author:Jithin Alex [Alex, Jithin]
Language: eng
Format: epub
Published: 2018-09-26T05:00:00+00:00


<--- Create a for loop to create multiple VLANs in a go. In python2, the default encoding is ASCII but in Python3, the default encoding is Unicode.

This is the reason, why we need to put the encoding command,to convert in to ASCII characters. Also note that we are converting the value on n to string value using str() command. --->

<--- Be careful about indentations. Python does care those white spaces and if you put it improperly, then your code wont work. --->

for n in range (2, 10):

tn.write(b"vlan " + str(n).encode("ascii") + b"\n")

tn.write(b"name Data_VLAN_" + str(n).encode("ascii") + b"\n")



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.