Mastering Python Scripting for System Administrators
eBook - ePub

Mastering Python Scripting for System Administrators

Write scripts and automate them for real-world administration tasks using Python

Ganesh Naik

Partager le livre
  1. 318 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Mastering Python Scripting for System Administrators

Write scripts and automate them for real-world administration tasks using Python

Ganesh Naik

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

Leverage the features and libraries of Python to administrate your environment efficiently.

Key Features

  • Learn how to solve problems of system administrators and automate routine activities
  • Learn to handle regular expressions, network administration
  • Building GUI, web-scraping and database administration including data analytics

Book Description

Python has evolved over time and extended its features in relation to every possible IT operation. Python is simple to learn, yet has powerful libraries that can be used to build powerful Python scripts for solving real-world problems and automating administrators' routine activities. The objective of this book is to walk through a series of projects that will teach readers Python scripting with each project.

This book will initially cover Python installation and quickly revise basic to advanced programming fundamentals. The book will then focus on the development process as a whole, from setup to planning to building different tools. It will include IT administrators' routine activities (text processing, regular expressions, file archiving, and encryption), network administration (socket programming, email handling, the remote controlling of devices using telnet/ssh, and protocols such as SNMP/DHCP), building graphical user interface, working with websites (Apache log file processing, SOAP and REST APIs communication, and web scraping), and database administration (MySQL and similar database data administration, data analytics, and reporting).

By the end of this book, you will be able to use the latest features of Python and be able to build powerful tools that will solve challenging, real-world tasks

What you will learn

  • Understand how to install Python and debug Python scripts
  • Understand and write scripts for automating testing and routine administrative activities
  • Understand how to write scripts for text processing, encryption, decryption, and archiving
  • Handle files, such as pdf, excel, csv, and txt files, and generate reports
  • Write scripts for remote network administration, including handling emails
  • Build interactive tools using a graphical user interface
  • Handle Apache log files, SOAP and REST APIs communication
  • Automate database administration and perform statistical analysis

Who this book is for

This book would be ideal for users with some basic understanding of Python programming and who are interested in scaling their programming skills to command line scripting and system administration.

Prior knowledge of Python would be necessary.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Mastering Python Scripting for System Administrators est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Mastering Python Scripting for System Administrators par Ganesh Naik en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Computer Science et System Administration. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2019
ISBN
9781789134261

Python Scripting Overview

Python is a scripting language, created by Guido van Rossum in 1991, which is used in various applications, such as game development, GIS programming, software development, web development, data analytics, machine learning, and system scripting.
Python is an object-oriented, high-level programming language with dynamic semantics. Mainly, Python is an interpreted language. Python is used for rapid application development, as it has all of the advanced features for development.
Python is simple and easy to learn, as its syntax makes programs more readable. Hence, the program maintenance cost is low.
Python has one more important feature of importing modules and packages. This feature allows for code reuse. The Python interpreter is easy to understand. We can write the complete code one by one in it and, as Python is an interpreted language, the code gets executed line by line. Python also has a wide range of libraries for advanced functionality.
This chapter will cover the following topics:
  • Python scripting
  • Installing and using Python and various tools
  • Variables, numbers, and strings
  • Python supported data structures and how to use all of these concepts in a script
  • Decision making; that is, the if statement
  • Looping statements; that is, the for and while loops
  • Functions
  • Modules

Technical requirements

Before you start reading this book, you should know the basics of Python programming, such as the basic syntax, variable types, tuple data type, list dictionary, functions, strings, and methods. Two versions, 3.7.2 and 2.7.15, are available at python.org/downloads/. In this book we'll work with version 3.7 for code examples and package installing.
Examples and source code for this chapter are available in the GitHub repository: https://github.com/PacktPublishing/Mastering-Python-Scripting-for-System-Administrators-.

Why Python?

Python has a wide range of libraries for open source data analysis tools, web frameworks, testing, and so on. Python is a programming language that can be used on different platforms (Windows, Mac, Linux, and embedded Linux H/W platforms, such as Raspberry Pi). It's used to develop desktop as well as web applications.
Developers can write programs with fewer lines if they use Python. Prototyping is very quick, as Python runs on an interpreter system. Python can be treated in an object-oriented, a procedural, or a functional way.
Python can do various tasks, such as creating web applications. It is used with the software to create workflows; it connects to database systems, handles files, handles big data, and performs complex mathematics.

Python syntax compared to other programming languages

The code written in Python is highly readable because it's similar to the English language. To complete a command, Python uses new lines.
Python has a great feature: indentation. Using indentations, we can define the scope for decision-making statements, loops such as for and while loops, functions, and classes.

Python installation

In this section, we will be learning about the installation of Python on different platforms, such as Linux and Windows.

Installation on the Linux platform

Most Linux distributions have Python 2 in their default installations. Some of them also have Python 3 included.
To install python3 on Debian-based Linux, run the following command in the Terminal:
sudo apt install python3
To install python3 on centos, run the following command in the Terminal:
sudo yum install python3
If you are unable to install Python using the preceding commands, download Python from https://www.python.org/downloads/ and follow the instructions.

Installation on the Windows platform

For installing Python in Microsoft Windows, you'll have to download the executable from python.org and install it. Download python.exe from https://www.python.org/downloa...

Table des matiĂšres