• Decrease font size
  • Default font           size
  • Increase font size

Python Part 2

Print E-mail

Course Description

This course moves the beginning Python programmer on to more advanced features such as regular expressions, working with binary data, and using the extensive functionality of Python modules. As with Part 1, extra emphasis is placed on features unique to Python.

This is a hands-on programming class. All concepts are reinforced by informal practice during the lecture followed by graduated lab exercises.

Python Programming is a practical introduction to a working programming language, not an academic overview of syntax and grammar. Students will immediately be able to use Python to complete tasks in the real world.

Who Should Attend?

This course is appropriate for advanced users, system administrators and anyone else who wants to automate or simplify common tasks with Python scripts. It is also a good foundation for web site administrators who want to use a Python-based framework such as Zope or Django to support their server installations.

Course Prerequisites

Students should have completed Python Intro (Part 1) or its equivalent. They should be comfortable using lists and tuples, reading and writing files, and with for and while loops.

Workshop exercises

Students will write numerous Python scripts to reinforce the major concepts covered in this course. The labs will increase in complexity as more sophisticated techniques are introduced.

Exercises will include all important topics covered in the lecture portion of the class. There are short "try-me" labs during the lecture, and then a longer lab at the end of each chapter.

 Public Course Information and Registration Page

Course Outline

Sorting

  • The sorted() function
  • Alternate keys
  • Using lambda functions
  • Using operator.itemgetter()
  • Sorting in reverse

Errors and Exception Handling

  • Dealing with syntax errors
  • Exceptions
  • Handling exceptions with try/except
  • Cleaning up with finally

Using Modules

  • What is a module?
  • The import statement
  • Function aliases
  • Packages

Regular Expressions

  • RE Objects
  • Pattern matching
  • Parsing data
  • Subexpressions
  • Complex substitutions
  • RE tips and tricks

Using the Standard Library

  • Working with the operating system
  • Grabbing web pages
  • Sending email
  • Using glob for filename wildcards
  • math and random
  • Accessing dates and times with datetime
  • Working with compressed files

An Introduction to Python classes

  • About o-o programming
  • Defining classes
  • Constructors
  • Instance methods
  • Instance data
  • Class methods and data
  • Destructors

Bonus Exercises

  • Assorted lab exercises to tie together all the newly-acquired Python skills.