LinuxCBT.com

Syllabus

Focus: Python Scripting | Automation

Duration: 12-Hours

  • Python - Object Oriented Linux Scripting Environment - Module III

    • Basics
      • Discuss Python's capabilities & features
      • Identify location of pre-installed Python
      • Discuss Python's Interactive interface
      • Use the interactive interface to ouput basic expressions
      • Hello World
      • Identify reserved keywords
      • Escape sequences & escape character exploration
      • Define Python script using Linux SHEBANG header
      • Execute Python scripts using the Python interpreter directly
      • Discuss data types including strings, integers, lists, tuples, dictionaries, etc.
      • Define standard variable types
      • Use the print function to examine ouput of variables and expressions
      • Use the type function to resolve data type
      • Use the id function to expose the memory location of the stored variable
      • Explain and define references and integrate with the id function
      • Comments definition
      • Perform basic arithmetic to illustrate the PEMDAS order of operations and examine how to alter it
    •  
    • General Python Information I
      • Explain and illustrate STDIN usage
      • Examine the input function
      • Examine the raw_input function
      • Compare and contrast between input and raw_input functions
      • Define small script to make use of input/raw_input and basic math functions
      • Python Function concepts, applications and definition
    •  
    • String Manipulation
      • Define and ascertain the length of strings
      • String extraction using list elements and list slicing
      • Discuss immutable and mutable data types
      • Loop through string slices using for loops
      • Compare strings using string operators
      • Discuss Python's object-oriented nature of various modules including classes and methods
      • Import strings module
      • Convert strings to upper and lower case using strings module methods
      • Split strings into lists
      • Join lists into strings
    •  
    • List Manipulation
      • Define lists
      • Discuss and Define tuples
      • Compare and contrast lists and tuples
      • Reverse lists
      • Append lists
      • Extend lists
      • Nest lists
      • Define multi-dimensional lists
      • Stack Lists using Last In First Out (LIFO) using the pop function
      • Define First In First Out (FIFO) lists to emulate queueing using the pop function
      • Insert values into various positions of the list
      • Use ranges to generate integers
      • Lists with Integers
      • Lists with Strings
      • Emulate standard UNIX Syslog logfile format using Lists
      • Parse emulated logfile format using the Split function
      • Recap list manipulation using integers, strings and various list methods
      • Explain and define Dictionaries - key/value pairs similar to Hashes in Perl
    •  
    • Control Structures
      • IF - Defintion and usage
      • Discuss the importance of indentation
      • Else/Elif - comparisons against integers and strings
      • Comparison negation
      • Write script to perform conditional testing
      • Import sys module to evaluate positional parameters using ARGV
      • Define script which requires minimum number of command-line arguments
      • Nest multiple if/elif statements to match logic
      • Explain how for loops work in Python
      • for loops definition and usage
      • Iterate through lists of strings using for loops
      • Integrate for loops with string manipulation functions and log file parsing
      • Define and use While loops
      • Define and examine the consequences of incorrect logic with an infinite while loop
      • Integrate while loop with raw_input function to obtain data from the end-user
      • Discuss file handle concepts and applications
      • Use control structures to generate output for use in File I/O exercises
      • Use the open function to read a file into a file handle
      • Iterate through the lines within the opened file using readline functions, etc.
      • Open file handles for writing
      • Open multiple file handles
      • Write strings to files using string formatting options and variable substitution
      • Parse source file by extracting columns to be stored in destination file
      •  
      • Regular Expressions
      • Discuss Regular Expressions
      • Import Regular Expressions module (re) for usage
      • Implement Regular Expressions (REs)
      • Regular Expressions Matching of strings and variables
      • REGEX Repeaters
      • Integrate Regular Expressions with text file processing
      • Exception Handling
      • Try & Except
      •  
      • Modules
      • Identification of default Python modules
      • Import modules (sys, os, etc.) for usage
      • Use the dir function to ascertain the classes and methods available within modules
      • Use the SHUTIL module for advanced, high-level File I/O (Copy, Move, etc.)
      • Python - Syslog integration
      • Define script using the Syslog module to log to syslog
      •  
      • Common Gateway Interface
      • CGI Discussion and applications
      • Implement Python CGI with Apache 2.x
      • Evaluate results of CGI integration
      • Globbing
    •  
    • Dictionaries
      • Further exploration of dictionaries
      • Parse log files into dictionary data structure
      • Organize results
      • Analyse data
    •  
    • Time
      • Review properties of various time functions
      • Export time with various functions
      • Use time functions to create log entries in process akin to Perl
      • Evaluate results
    •  

LinuxCBT Python Edition

  •  
DEMO