Читать книгу The Smart Cyber Ecosystem for Sustainable Development - Группа авторов - Страница 24

1.5.3 Python

Оглавление

As a lightweight versatile scripting programming language, Python is very much popular and useful in IoT-based application development [25]. It provides some kind of relaxed environment, i.e., it does not follow strict rules. Python-Integrated Development Environment (IDE) provides several modules and libraries, using which one can establish connectivity with many hardware and also compatible with multiple OS such as windows, Linux, and MAC. Well-known Python IDEs are Spyder and PyCharm.

To perform file operation in Python, we do not require any separate library, and it is an in-built function such as open(), read(), write(), and close(). Python supports various file formats to perform such operations like .Txt file and .CSV file. This feature makes data management easier using python programming language. If our data file is of the type of image, then we have a Python Image Library (PIL) to do the process with such a file. In this library, there are famous functions/methods like open(), show(), resize(), rotate(), print(), and convert() to do various tasks on such images that are contained in an image file.

Python also supports client-server architecture model and provides necessary network services to it. Socket programming in Python allows us to implement clients and servers for connection oriented as well as connection less protocols. In socket programming of Python, we have to import “socket” and “sys” libraries that contain well-known and most utilized functions for example connect(), send(), and listen() using which one can establish connection between clients (IoT nodes) and server. Python has also a separate library that provides and deals with a specific application level network protocol(s).

Thus, Python is a versatile object oriented programming language that provides an easy environment in open source community software for the development of IoT-based applications.

The Smart Cyber Ecosystem for Sustainable Development

Подняться наверх