Complete Python Scripting for Automation

Video description

Get up to speed with automating repetitive tasks with Python

About This Video

  • Understand how to use Atom Editor to run a Python script
  • Get to grips with arithmetic and assignment operators

In Detail

Over the last few years, Python has gained immense popularity. The demand for the programming language in the job market has particularly increased and being well-versed with it can help you enter some of the most exciting industries, including data science, artificial intelligence (AI), web applications, server-side automation, and home automation.

This course will make it easy for you to learn Python, with an emphasis on server-side automation. You will not only get to grips with core Python but also focus on advanced Python. Gradually, the course will take you through writing a Python script to print the OS name. You'll also learn how to pass elements into a program using *args. To build on your knowledge further, you'll understand the technique of transferring a file from a local server to a remote server and vice versa using paramiko.

By the end of this course, you will have learned how to automate a wide variety of tasks with the help of Python scripting.

Who this book is for

This course is for anyone who is just getting started with programming and is looking to learn Python from scratch.

Publisher resources

Download Example Code

Table of contents

  1. Chapter 1 : Introduction
    1. Introduction to the Python
    2. Python setup on Windows
    3. Python setup on Linux (Installing required python on Linux)
    4. Editors for Python code
    5. How to use Atom Editor to run python script
  2. Chapter 2 : Basics of print, indentation, comments and special characters
    1. simple hello world script
    2. Python Indentation
    3. Python Comments
    4. Usage of special characters with print statement
    5. Running Python script on Windows and Linux
  3. Chapter 3 : Basics of variables and Data Types
    1. Introduction to variables and print with variables
    2. Data Types
    3. working with multiple variable and strings in print
    4. Input and Output Syntax
  4. Chapter 4 : Complete String Operations
    1. Basic operations on strings
    2. case (Lower, Upper etc...) conversion operations
    3. Boolean result operations
    4. join, center and zfill (zero fill)
    5. strip, split operations
    6. count, index and find operations on strings
    7. Practice: Display given string at left/right/center of a line in title format
  5. Chapter 5 : Data Structures of Python
    1. Introduction to Data Structures and Types of Data Structures
    2. Lists
    3. Tuples
    4. Dictionaries
    5. Sets
  6. Chapter 6 : Operators of Python
    1. Introduction to Operators of Python
    2. Arithmetic and Assignment Operators
    3. Comparison Operators
    4. Identity and Membership operators
    5. Logical Operators
  7. Chapter 7 : Conditional statements
    1. Introduction to conditional statements; simple if condition
    2. if ... else and if ... elif ... elif ... else condition
    3. Practice with conditional statements
  8. Chapter 8 : Working with Python Modules
    1. Introduction to Python Modules
    2. platform module
    3. getpass module
  9. Chapter 9 : sys module
    1. Introduction to sys module
    2. sys.argv | working with command line arguments with an example
  10. Chapter 10 : OS Module
    1. Introduction to OS Module and Basic operation
    2. os.path module
    3. os.system() function from os module
    4. Practice script on platform and os module
    5. os.walk(path)
    6. Best Practice with os.walk for real-time
  11. Chapter 11 : Loops - for and while loops with break, continue and pass
    1. Practice: Read a path and check if given path is a file or a directory
    2. Introduction to loops with an example
    3. Loops | Working with for loop
    4. Simple practice with for loop
    5. Find all files in a directory with required extension.py/.sh/.log/.txt etc…
    6. Complete range() function
    7. for loop to work with strings, list, tuple and dictionaries
    8. Introduction to while loop
    9. Loop Control statements: break, continue and pass
  12. Chapter 12 : datetime module to work with dates and times
    1. Introduction to datetime module
    2. Practice: Find the files which are older than x days from a given path
  13. Chapter 13 : subprocess Module: To execute any Operating System Commands with python
    1. Introduction to subprocess module
    2. Practice-1 with subprocess module
    3. Practice-2: Platform independent script to find the java version
  14. Chapter 14 : Working with text files
    1. Working with text files: Reading and writing to text files
    2. Copy the content of a source file into a destination file
  15. Chapter 15 : Working with csv
    1. Introduction to csv files and How to read a csv files using python?
    2. Read only header of a csv file and Finding the no of rows in a csv file
    3. Creating csv file
  16. Chapter 16 : Working with files like json
    1. Working with json files
  17. Chapter 17 : Exception Handling
    1. Introduction to Exception Handling
    2. Exception Handling for known Exceptions
    3. try except else and finally usage
    4. Raise user Defined Exceptions
  18. Chapter 18 : Functions
    1. Introduction to Functions
    2. How to define a Function and How to use defined Function, Types of Functions
    3. Converting simple code into Functions
    4. Calling a function from another function and Scope of the variables
    5. Simple Functions with arguments
    6. Functions with arguments and return value
    7. Functions with default arguments
    8. Functions with keyword-based arguments
    9. Functions with Variable length arguments
    10. Functions with variable keyword arguments
    11. How to use Functions of one script into another script, what is __name__ ?
    12. Simple exception handling to changing current working directory
  19. Chapter 19 : Regular expression with re module
    1. Introduction to regular expressions
    2. Basic rules to create a pattern for regex
    3. Rules to create a pattern Part-2
    4. Rules to create a pattern Part-2
    5. Regex with Flags
    6. working with search and match operations from re module
    7. working with findall and finditer operations
    8. working with split, sub and subn operations of re module
    9. compile operation (Execute all re operations on compile object)
  20. Chapter 20 : Paramiko module to work with remote servers using python
    1. Introduction to paramiko
    2. Transfer file from local server to remote server and vice versa using paramiko
  21. Chapter 21 : Shutil module
    1. Part-1: copy file(s) with shutil module
  22. Chapter 22 : OOPS for Real Time
    1. Introduction to oops
    2. Class and object attributes
    3. Constructor of a class
    4. Simple Python Script without and with oops concepts
    5. destructor of a class
    6. Polymorphism and inheritance of python oops
    7. Encapsulation
  23. Chapter 23 : Windows Subsystem for Linux
    1. Linux for Developers on Windows

Product information

  • Title: Complete Python Scripting for Automation
  • Author(s): Narendra Kumar Reddy Polu
  • Release date: March 2020
  • Publisher(s): Packt Publishing
  • ISBN: 9781800203181