Introduction to Python
I decided to get familiar with Python so thought I would start sharing my notes. I have done some scripting in the past to help me get things done quicker, eliminate doing the same task multiple times and to manipulate data, most of this was done using Perl (and a few years back when I was focused on NMS/OSS tasks). In the current project i am working on I have been testing applications API and thought instead of just using curl to pull back the JSON/XML output I would go a step further and use Python and then manipulate the data into a desired format. The other desire to get a better understanding is the way the industry (automation, orchestration and SDN) is going and the adoption of Python to achieve many tasks.
To start of with I got familiar with the basics.
Unlike other languages Python requires a structure to be followed, to help me with this (and also save me time) I have been using Sublime Text 2 as my text editor (it has some nice plugins for Cisco Syntax as well).
These are just example of the syntax, if you are new to scripting or programming I would recommend that you either get a book (can be a bit dry), take an on-line course (I have used www.udemy.com and www.codecademy.com/tracks/python but a search will show many exit) or read one of the many tutorials on the Internet.
|
|
As I increase my Python knowledge I will update and add new notes as well as put some example up, so far I like Python much more than other languages I have played with and seems very powerful.