Skip to main content

Instructor-led training

Advanced Python 3 (3 Day Course) Training in Yucaipa, California

In this Python training course, students already familiar with Python programming will learn advanced Python techniques such as: IPython Notebook; the Collections module; mapping and filtering; lamba functions; advanced sorting; working with regular expressions; working with data…

What you'll learn

In this Python training course, students already familiar with Python programming will learn advanced Python techniques such as: IPython Notebook; the Collections module; mapping and filtering; lamba functions; advanced sorting; working with regular expressions; working with databases, CSV files, JSON and XML; writing object-oriented code; testing and debugging; and learning about Unicode and text encoding. This advanced Python course is taught using Python 3, however, differences between Python 2 and Python 3 are noted.

Private Training for Teams

This course is offered as private, instructor-led training for organizations, onsite in Yucaipa, California or live online. Dates, delivery format, and course content are arranged around your team's requirements.

This course is not currently scheduled as a public class for individual enrollment.

Request Group Training

Prerequisites

Basic Python programming experience. In particular, you should be very comfortable with: working with strings; working with lists, tuples and dictionaries; loops and conditionals; and writing your own functions. Exposure to HTML, XML, JSON, and SQL would be useful.

Course Outline

IPython Notebook
Getting Started with IPython Notebook
Exercise 1: Creating Your First IPython notebook
Exercise 2: More Experimenting with IPython Notebook
Getting the Class Files
Markdown
Magic Commands
Automagic
Autosave
Directory Commands
Bookmarking
Command History
Last Three Inputs and Outputs
Environment Variables
Loading and Running Code from Files
Shell Execution
More Magic Commands
Getting Help
 
Advanced Python Concepts.....
Advanced List Comprehensions
Quick Review of Basic List Comprehensions
Multiple for Loops
Exercise 3: Rolling Five Dice
Collections Module
Named Tuples
Default Dictionaries (defaultdict)
Exercise 4: Creating a defaultdict
Counters
Exercise 5: Creating a Counter
Mapping and Filtering
Map (function, iterable)
Filter (function, iterable)
Lambda Functions
Using Lambda Functions with map() and filter()
Mutable and Immutable Built-in Objects
Strings are Immutable
Lists are Mutable
Sorting
Sorting Lists in Place
The sorted() Function
Exercise 6: Converting list.sort() to sorted(iterable)
Sorting Sequences of Sequences
Sorting Sequences of Dictionaries
Unpacking Sequences in Function Calls
Exercise 7: Converting a String to a datetime.date Object
Modules and Packages
Modules
Packages
Search Path for Modules and Packages
 
Regular Expressions
Regular Expression Syntax
Try it
Backreferences
Python's Handling of Regular Expressions
 
Working with Data
Relational Databases
PEP 0249 -- Python Database API Specification v2.0
PyMySQL
Returning Dictionaries instead of Tuples
sqlite3
Exercise 8: Querying a SQLite Database
Passing Parameters
SQLite Database in Memory
Executing Multiple Queries at Once
Exercise 9: Inserting File Data into a Database
CSV
Reading from a CSV File
Finding Data in a CSV File
Exercise 10: Comparing Data in a CSV File
Creating a New CSV File
CSV Dialects
Getting Data from the Web
The Requests Package
Beautiful Soup
XML
Exercise 11: Requests and Beautiful Soup
JSON
 
Classes and Objects
Attributes
Behaviors
Classes vs. Objects
Everything Is an Object
Creating Custom Classes
Attributes and Methods
Exercise 12: Adding a roll() Method to Die
Private Attributes
Properties
Exercise 13: Properties
Objects that Track their Own History
Documenting Classes
Using docstrings
Exercise 14: Documenting the Die Class
Inheritance
Overriding a Class Method
Extending a Class
Exercise 15: Extending the Die Class
Extending a Class Method
Exercise 16: Extending the roll() Method
Static Methods
Class Attributes and Methods
Class Attributes
Class Methods
You Must Consider Subclasses
Abstract Classes and Methods
Understanding Decorators
 
Testing and Debugging
Testing for Performance
time.perf_counter
The timeit Module
The unittest Module
Unittest Test Files
Exercise 17: Fixing Functions
Special unittest.TestCase Methods
Assert Methods
 
Unicode and Encoding
Bits and Bytes
Hexadecimal Numbers
Exercise 18: Converting Numbers between Number Systems
hex(), bin(), ord(), chr(), and int()
Encoding
Encoding Text
Encoding and Decoding Files in Python
Converting a File from cp1252 to UTF-8
Exercise 19: Finding Confusables

What makes this material hard to master

The course is a tour of intermediate-to-advanced Python, and the difficulty comes from how much each block assumes of the one before it. The syllabus is ordered so later topics reuse earlier ones.

  • Functional idioms and data structures. Advanced list comprehensions (including multiple for loops), map() and filter() with lambda functions, and the Collections module (named tuples, defaultdict, Counter). Learners often treat these as shorthand for loops, then struggle to choose between them.
  • Mutability and sorting. The syllabus pairs mutable and immutable built-ins with list.sort() versus sorted(), sorting sequences of sequences and of dictionaries, and unpacking in function calls. The common misconception is that sort() returns a new list. Aliasing bugs follow from the same confusion.
  • Regular expressions. Syntax, backreferences and how Python handles patterns. Patterns that pass a quick test often fail on real input.
  • Data access. The Python database API (PEP 249) with PyMySQL and sqlite3, parameter passing, CSV reading, writing and dialects, then Requests, Beautiful Soup, XML and JSON. Each source has its own shape, and the work is mapping them into consistent Python structures.
  • Object-oriented design. Custom classes, properties, docstrings, inheritance, class and static methods, abstract classes and decorators. The syllabus warns that you must consider subclasses when writing class methods, a point many learners miss.
  • Text encoding. Bits and bytes, hexadecimal, ord() and chr(), encoding and decoding files, and converting a file from cp1252 to UTF-8. Bytes versus text is a hard distinction, and the course notes differences between Python 2 and Python 3 that explain why older code behaves differently.

The course also covers testing with unittest and timing with time.perf_counter and timeit, and it starts with IPython Notebook and its magic commands as the working environment.

Who it suits and what to take around it

The course is for developers who already write Python functions and are comfortable with strings, lists, tuples, dictionaries, loops and conditionals. Some exposure to HTML, XML, JSON and SQL helps with the data-access sections. It also suits teams who maintain older scripts, because Python 2 differences are noted throughout and Python 2 support ended in January 2020.

If those fundamentals are shaky, Introduction to Python 3.x covers them first, so the advanced material is not spent on basics. For analysis-heavy follow-up work, Python Data Analysis with NumPy and Pandas is a natural next step once you can read CSV, JSON and database data in plain Python.

Other courses are listed in the Python Programming courses and learning guide.

Illustrative scenarios

The scenarios below are illustrations of how the course material can be applied. They are not descriptions of specific organizations or of the course's lab exercises.

  • Consolidating exports. A team might read several CSV exports with different dialects, compare records, load the results into SQLite using parameterized inserts, and use Counter and defaultdict to summarize them. This draws on the CSV, sqlite3 and Collections topics.
  • Collecting data from the web. For example, a developer could fetch a page with Requests, extract fields with Beautiful Soup, and write the result as JSON. Regular expressions with backreferences could clean up messy values along the way.
  • Maintaining older text-processing scripts. A team might inherit scripts written for Python 2 that process cp1252 files. The encoding and decoding topics, along with the noted Python 2 and Python 3 differences, show where behavior changes and how to convert files to UTF-8. Wrapping the logic in classes with unittest tests makes later changes safer.

AI coding assistants for these topics

AI coding assistants are useful for drafting comprehensions, regular expressions, SQL snippets, CSV handling and first-pass unittest cases. They often fall short in the places this course focuses on:

  • Regular expressions. A generated pattern may match the sample you gave and still fail on other inputs. Test it against valid, invalid and empty strings.
  • Database code. Assistants sometimes build queries by string formatting. Check that values go through parameter passing, as the syllabus teaches.
  • Encodings. Generated file code may assume UTF-8 or omit explicit encodings. Check it against files such as cp1252 input and non-ASCII text.
  • Mutation and class design. Look for unintended in-place changes, shared mutable state, and class methods that break in subclasses.
  • Version assumptions. Output may mix Python 2 and Python 3 idioms, so confirm it runs on the interpreter you actually use.

To verify, write unittest tests for edge cases (empty input, odd characters, duplicate keys), run the code, and compare alternatives with timeit before accepting a claim about performance. Review generated code before using it to automate business processes.

Frequently asked questions

What level is this course?

It is advanced. It assumes you already write Python functions and work comfortably with strings, lists, tuples, dictionaries, loops and conditionals.

Do I need to know SQL, XML or JSON beforehand?

Exposure to HTML, XML, JSON and SQL is useful but not required. The course covers relational databases through sqlite3 and PyMySQL, CSV, XML and JSON.

Does the course cover Python 2?

The course is taught in Python 3 and notes the differences from Python 2. That helps teams reading or maintaining older code. Python 2 support ended in January 2020.

Can this be delivered privately onsite or online?

Yes. Private training for organizations can be delivered at the client's location or live online.

Can the content be customized?

Private courses can be tailored, including to the Python versions your organization uses. You can request a training proposal to discuss your needs.

Training locations

Advanced Python 3 (3 Day Course) training across the U.S. and beyond.

We provide private Advanced Python 3 (3 Day Course) training for organizations, onsite at your location or live online, throughout the United States and internationally.

View all Advanced Python 3 (3 Day Course) training locations

Train your team with HSG

Private, instructor-led training customized for your organization.

  • Onsite or live online delivery
  • Customized curriculum
  • For a single employee or an entire team
  • Flexible scheduling
  • Experienced instructors
Request Group Training

Questions? Call us at 303.377.6176
or email info@hartmannsoftware.com

Ready to train your team?

Let's customize this training for your organization.

Tell us about your employees, your goals, and your preferred schedule. We'll prepare a training proposal covering scope, delivery format, and pricing.