Intermediate Python 3.x (CP-TM)

This course is intended for advanced users, system administrators and website administrators who want to use Python to support their server installations in an enterprise development environment.

Type

Certified Training Course

Level

Intermediate

Cost

R 10 900 p.p. (Excl VAT)

SATV Redeemable 

N/A

Delivery Method

Classroom-based, Instructor-led with emphasis on hands-on exercises.

Duration

5 days

Start time: 09:00 (Registration will commence at 08:30 on the first day)

Prerequisites

The knowledge and skills that a learner must have before attending this course is as follows:

  • System administration experience on Microsoft Windows or Linux operating systems.
  • Understanding of concepts presented in the self-paced, 3 hour VMware Data Center Virtualization Fundamentals course.

Course Objectives

At the end of this course, you should be able to do the following:

  • Understand the OS Services
  • Use the various pythonic programming principles
  • Understand the use of various modules and packages
  • Define and use Classes
  • Implement Metaprogramming
  • Use Python developer tools
  • Access databases using Python programming
  • Use PyQt4 framework
  • Understand and use network programming
  • Use Python programming for System Administration and Scripting
  • Understand and use XML and JSON

Exam & Certifications

None.

Course Topics

1. Python Refresher

  • Variables
  • Basic Python Data Types
  • Sequences
  • Mapping Types
  • Program Structure
  • Files and Console I/O
  • Conditionals
  • Loops
  • Buil tins

2. OS Services

  • The OS Module
  • Paths, Directories and Filenames
  • Environment Variables
  • Launching external Programs
  • Walking Directory Trees
  • The Datetime Module
  • The Calendar Module

3. Pythonic Programming

  • The Zen of Python
  • Common Python Idioms
  • Unpacking Function Arguments
  • Lambda Functions
  • List Comprehensions
  • Iterables
  • Writing Generator
  • String Tricks
  • String Formatting

4. Modules and Packages

  • Using import
  • Module Search Path
  • Namespaces
  • Executing Modules as Scripts
  • Packages
  • Configuring Import with __init__.py
  • Name Resolution (AKA scope)
  • Python Style

5. Classes

  • Defining Classes
  • Instance Objects
  • Instance Attributes
  • Instance Methods
  • __Init__
  • Properties
  • Class Data
  • Class Methods
  • Inheritance
  • Multiple Inheritance
  • Using Super ()
  • Special Methods
  • Class-Private Variables
  • Static Methods

6. Metaprogramming

  • Globals() and Locals()
  • Working with Attributes
  • The Inspect Module
  • Decorator Functions
  • Decorator Classes
  • Decorator Parameters
  • Creating Classes At Runtime
  • Monkey Patching

7. Developer Tools

  • Program Development
  • Comments
  • Pylint
  • Customising pylint
  • Using pyreverse
  • The unittest module
  • Fixtures
  • Skipping Tests
  • Making a Suite of Tests
  • Automated Test Discovery
  • Using Nose
  • The Python Debugger
  • Starting Debug Mode
  • Stepping Through a Program
  • Setting Breakpoints
  • Profiling
  • Benchmarking

8. Database Access

  • The DB API
  • Available Interfaces
  • Connecting to a Server
  • connect() examples
  • Creating a cursor
  • Executing a statement
  • Parameterised statements
  • Dictionary cursors
  • Metadata
  • Transactions
  • Object-relational mappers

9. PyQt4

  • Event Driven Applications
  • GUI Application Flow Chart
  • External Anatomy of a Pyqt4 Application
  • Internal Anatomy of a Pyqt4 Application
  • Using Designer
  • Anatomy of a Designer-Based Application
  • Naming Conventions
  • Common Widgets
  • Layouts
  • Selectable Buttons
  • Actions and Events
  • Menu Bar
  • Status Bar
  • Using Predefined Dialogs
  • Creating Custom Dialogs
  • Tabs
  • Niceties
  • Working with Images
  • Complete Example

10. Network Programming

  • Sockets
  • Socket options
  • Client Concepts
  • Server Concepts
  • Application Protocols
  • Forking Servers
  • Grabbing HTML from the Web
  • Consuming Web Services
  • Web Data the Easier Way
  • Sending email
  • Binary Data
  • The struct module

11. Multiprogramming

  • What are Threads?
  • The Python Thread Manager
  • The Threading module
  • Threads for the impatient
  • Creating a thread class
  • Variable Sharing
  • Using Queues
  • Debugging threaded programs
  • The Multiprocessing module
  • Alternatives to multiprogramming

12. System Administration and Scripting

  • The subprocess module
  • Subprocess Convenience Functions
  • Using the Sh module
  • Permissions
  • Saving Information
  • Creating a useful Command Line Script
  • Creating Filters
  • Parsing the Command Line
  • Simple logging
  • Logging Levels
  • Formatting Log Entries
  • Logging to other Destinations

13. XML and JSON

  • About XML
  • Normal approaches to XML
  • Which Module to use?
  • Getting Started with ElementTree
  • How ElementTree works
  • Creating a new XML Document
  • Parsing an XML Document
  • Navigating the XML Document
  • Using XPath
  • About JSON
  • Reading JSON
  • Writing JSON

14. Extending Python

  • Why extend Python?
  • Ways to extend Python with C
  • Hand-Coded C
  • Overview
  • The C Program
  • Methods
  • The Method Table
  • The Init function
  • Handling errors
  • Custom Exception Objects
  • Putting it all together
  • Using SWIG
  • The interface file
  • Generating the Wrappers
  • Building and installing the extension