- Hands-On Enterprise Automation with Python.
- Bassem Aly
- 357字
- 2021-06-18 19:22:28
Why use Python for network automation?
Python is a pretty well-structured and easy programming language available today and targets many areas in technology, web and internet development, data mining and visualization, desktop GUI, analysis, game building, and automation testing; that's why it's called a general purpose language.
So, there are three reasons to choose Python:
- Readability and ease of use: When you develop using Python, you actually find yourself writing in English. Many keywords and program flows inside Python are structured to have readable statements. Also, Python doesn't require ; or curly braces to start and end blocks, which gives Python a shallow learning curve. Finally, Python has some optional rules, called PEP 8, that tell Python developers how to format their program to have readable code.
You can configure PyCharm to take care of these rules and check whether your code violates them or not by going to Settings | Inspections | PEP 8 coding style violation:

- Libraries: This is the real power of Python: libraries and packages. Python has a wide range of libraries in many areas. Any Python developer can easily develop a Python library and upload it online to make it available to other developers. Libraries are uploaded to a website called PyPI (https://pypi.Python.org/pypi) and linked to a GitHub repository. When you want to download the library to your PC, then you use a tool called pip to connect to PyPI and download it locally. Network vendors such as Cisco, Juniper, and Arista developed libraries to facilitate access to their platforms. Most vendors are pushing to make their libraries easy to use and require minimum installation and configuration steps to retrieve useful information from devices.
- Powerful: Python tries to minimize the number of steps required to reach the end result. For example, to print hello world using Java, you will need this block of code:

However, in Python, the whole block is written in one line to print it, as shown in the following screenshot:

Combining all these reasons together leads to making Python the de facto standard for automation and the first choice for vendors when it comes to automating network devices.
- R語言數(shù)據(jù)分析從入門到精通
- Visual FoxPro程序設(shè)計(jì)教程(第3版)
- Servlet/JSP深入詳解
- 微信小程序開發(fā)實(shí)戰(zhàn):設(shè)計(jì)·運(yùn)營·變現(xiàn)(圖解案例版)
- Application Development with Swift
- SSH框架企業(yè)級應(yīng)用實(shí)戰(zhàn)
- Java設(shè)計(jì)模式深入研究
- Swift High Performance
- JavaScript前端開發(fā)基礎(chǔ)教程
- Qt 5.12實(shí)戰(zhàn)
- 梔子貓的奇幻編程之旅:21天探索信息學(xué)奧賽C++編程
- Hands-On Full Stack Development with Angular 5 and Firebase
- 軟件工程基礎(chǔ)
- 40 Algorithms Every Programmer Should Know
- Java修煉指南:核心框架精講