Overview of Python for Automation
A 3 day introduction to Python Programming for software developers that covers basic language constructs, file I/O, OO programming, command line processing, managing processes and XML web clients. The focus is on using best practices and techniques to develop professional quality programs and scripts. Optionally this course can be customized by adding modules on Numeric Python and Plotting that are described the companion course Python Programming for Scientists
Pre-Requisites
This course is designed for programmers who know at least one programming or scripting language: no prior knowledge of Python or OO programming is assumed.
Course Objectives
• Understand Python syntax, flow control, data structures and objects
• Read and write files
• Develop scripts for use in a Linux or Windows environment
• Understand best practices for error handling, recovery and logging
• Manipulate data using simple and complex regular expressions
• Design and develop user defined classes for handling structured data
• Read data from a web server.
Chapter 1 Python Introduction
• Variables and Objects
• Console I/O
• IF statements and indentation
Chapter 2 Python Objects
• Object notation
• String and numeric data
• WHILE loop
Chapter 3 Functions
• Functions
• Arguments and return values
• Importing modules
Chapter 4 Sequences
• List and Tuples
• FOR loop
• List comprehension
Chapter 5 Exceptions
• Handling exceptions with TRYEXCEPT
statements
• Raising exceptions
• Exception safe code and the WITH
statement
Chapter 6 File Handling
• Reading and writing files
• Working with the file system
Chapter 7 Data Collections
• Sets
• Dictionaries
Chapter 8 Working with modules
• Organising modules
• Using PYTHONPATH
• Building Libraries
Chapter 9 Command line processing
• Command line processing
• Command line options
• Exit codes and exit functions
Chapter 10 Managing processes
• Using sub process to run commands
• Reading sub command?s STDOUT
and STDERR
• Writing to a sub command?s STDIN
Chapter 11 Advanced Functions
• Variable arguments list and named
argument lists
• Function pointers
• Lambdas and generators
Chapter 12 Classes and Data Structures
• Classes and objects
• Constructors
• Object methods and special
methods
Chapter 13 Designing Classes
• Supporting subscripts and slices
• Building an iterator class
• Working with the resource manager
Chapter 14 Text Handling with Regular Expressions
• Basic pattern matching
• Pattern repetitions
• Capture groups
Chapter 15 File processing
• Working with CSV files
• Working with fixed field files
Chapter 16 Web Clients
• Reading data from a web page URL
• Parsing XML using ElementTree
Chapter 17 Calling C Code
• Calling C functions
• Passing data between C and Python