官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 于田县| 开远市| 新田县| 邳州市| 德江县| 乌鲁木齐县| 于都县| 碌曲县| 天峻县| 塘沽区| 通化市| 新干县| 平度市| 昆山市| 阿克| 伊吾县| 临西县| 克什克腾旗| 集安市| 贡嘎县| 碌曲县| 福泉市| 福清市| 忻州市| 区。| 新野县| 奇台县| 惠东县| 东丰县| 临清市| 元阳县| 扶余县| 那曲县| 沛县| 芜湖市| 陆河县| 黄大仙区| 乌拉特后旗| 苍山县| 华宁县| 上虞市|