Python Programming


Course Description:

This course introduces the student to the Python language. Upon completion of this class, the student will be able to write non trivial Python programs dealing with a wide variety of subject matter domains. Topics include language components, the IDLE environment, control flow constructs, I/O, sequences, collections, mappings, classes, GUIs, modules, regular expressions, and debugging. The course is supplemented with many hands on labs using either Linux or Windows.

Who should attend this course?

This course is designed for anyone who needs to learn how to write programs in Python.


Students should have taken the Software Development for Non-Programmers course or have some experience with at least one programming language. Typically, students in this course will have already programmed in either C, C++, Java, Perl, Ruby, VB, or anything equivalent to these languages.

Benefits of Attendance:

· Execute any Python code in a variety of environments

· Use correct Python syntax in Python programs

· Use the correct Python control flow construct

· Write Python programs using various collection data types

· Write home grown Python functions

· Use many of the standard Python modules such as os, sys, math, and time

· Trap various errors via the Python Exception Handling model

· Use the IO model in Python to read and write disk files

· Create their own classes and use existing Python class

· Understand and use the Object Oriented paradigm in Python programs

· Use the Python Regular Expression capabilities for data verification

· Write Graphical User Interfaces via the use of the Tkintermodule

· Apply Python to daily programming needs

Course Outline:

· An Introduction to Python

o Introductory Remarks about Python

o Strengths and Weaknesses

o A Brief History of Python

o Python Versions

o Installing Python

o Environment Variables

o Executing Python from the Command Line


o Editing Python Files

o Getting Help

o Dynamic Types

o Python Reserved Words

o Naming Conventions

· Basic Python Syntax

o Introduction

o Basic Syntax

o Comments

o String Values

o String Operations

o The String format Method

o String Slicing

o String Operators

o Numeric Data Types

o Conversions

o Simple Input and Output

o The print Function

· Language Components

o Introduction

o Control Flow and Syntax

o Indenting

o The if Statement

o Relational Operators

o Logical Operators

o True or False

o Bit Wise Operators

o The while Loop

o The for Loop

· Collections

o Introduction

o Lists

o Dynamic Lists

o Sets

o Dictionaries

o Tuples

o Copying Collections

· Functions

o Introduction

o Defining Your Own Functions

o Parameters

o Documentation

o Keyword and Optional Parameters

o Passing Collections to a Function

o Variable Number of Arguments

o Scope

o Functions - First Class Citizens

o Some Advanced List Functions

o Lambda

o Modules

o Standard Modules - sys

o Standard Modules - math

o Standard Modules - time

o The dir() Function

· Exceptions

o Errors

o Run Time Errors

o The Exception Model

o Exception Hierarchy

o Handling Multiple Exceptions

o raise

o assert

o Writing Your Own Exception Classes

· Input and Output

o Introduction

o Data Streams

o Creating Your Own Data Streams

o Access Modes

o Writing Data to a File

o Reading Data From a File

o Additional File Methods

o Using Pipes as Data Streams

o Handling IO Exceptions

o Working with Directories

o Metadata

o The Pickle Module

· Classes in Python

o Classes in Python

o Principles of Object Orientation

o Creating Classes

o Instance Methods

o File Organization

o Pydoc

o Special Methods

o Class Variables

o Inheritance

o Polymorphism

o Type Identification

o Custom Exception Classes

· Regular Expressions

o Introduction

o Simple Character Matches

o Character and Character Classes

o Quantifiers

o Greedy Matches

o Grouping

o The re Module

o Substituting

o Splitting

o Compiling Regular Expressions

o Flags

· Writing GUI's in Python

o Introduction

o Components and Events

o An Example GUI

o The root Component

o Adding a Button

o Entry Widgets

o Text Widgets

o Checkbuttons

o Radiobuttons

o Listboxes

o Frames

o Menus

o Binding Events to Widgets

· Data wrangling

o Output formatting

o The string module

o Compiling regular expressions

o Text matching and substitution

o Extended regular expressions

o Subexpressions and backreferences

o Alternate data formats

o Filename and path manipulation

· OS Services

o Using os.path

o Working with file systems

o Using os

o Process parameters

o Executing external commands

o Time and date data

o Environment variables

· Graphical programming

o Graphical programming overview

o About Tk

o The TkInter module

o Creating widgets

o Packing widgets

o Fonts, colors, and other widget attributes

o Starting the application

o Bindings and events

· Creating modules

o Module overview

o Understanding namespaces

o Writing functions

o Variable scope

o Documentation

o Distributing modules

· Testing and debugging

o Debugging issues

o Using the debugger

o Post-mortem debugging

o Designing tests

o Creating unit tests

o Making and using a test harness

· Fun with objects

o Defining classes

o Inheritance

o Multiple inheritance

o Auto-generating methods

· Pythonic Programming

o Python style

o Lambda functions

o List comprehensions

o Generators and iterators

· Network services

o Using FTP

o Sending with SMTP

o Python and CGI

o Plain CGI

o A shopping cart example

o Using templates

· Database access

o DB-API overview

o The dbi module

o The odbc module

o Queries

o Non-query statements

· Using XML Data

o XML Data

o SAX vs. DOM

o Using xml.sax

o Parsing an XML file

o Using xml.dom

o Accessing XML objects

· Object serialization (AKA Pickling)

o About serialization

o The pickle module

o Using dump()

o Using load()

o Where to use

· Python Cookbook

o Working with zipped data

o Copying objects

o Obtaining random numbers

o Benchmarking code

o Application logging

o Parsing command line options

Share this page!