Introduction to Python
for Network Engineer
Before We Start
Do you know these following languages?
´ A script programming language
´ A high-level programming language
´ No compilation
´ No datatype declaration
What can Python do?
Many many things which Python could do
but the only one thing we will talk about is
“ Network Automation”
Running Python: Interactively
Python is pre-installed on Linux platform
[porhai@python ~]$ python
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "Hello world"
connection.write(username + "n")
connection.write(password + "n")
connection.write("show run int g0/1 n")
Output = connection.read_very_eager()
#Closing the connection
print "Input parameter error! Please check username, password
and file name."
Python Program Executed
[porhai@python ~]$ python khnog.py
User Access Verification
S1#show run int g0/1
Current configuration : 66 bytes
no ip address
´ Python Language Comparison
´ Python Lesson
´ Python for Network Engineers