Module 06 of 10

Standard Library & Error Handling

Lessons

About This Module

Python's biggest strength is that it comes with a huge toolbox already built in. The standard library gives you ready-made modules for working with files and folders, dates and times, and much more, so you don't have to reinvent the wheel or install anything extra.

You'll start with the os module to interact with your operating system, then use datetime to work with dates, times, and time zones. Next you'll learn how Python handles things going wrong: catching errors with try/except, raising your own exceptions, and recording what your program is doing with the logging module.

With these tools you can write programs that are more robust and easier to debug, and you'll be ready for the next module, Databases & ORMs, where you'll store and query your data.

Lessons

4 videos
01

Python Tutorial: OS Module - Use Underlying Operating System Functionality

How to work with your operating system from Python: getting the current directory, listing and creating folders, renaming and removing files, and building paths that work on any platform.

02

Python Tutorial: Datetime Module - How to work with Dates, Times, Timedeltas, and Timezones

How to create and format dates and times, do arithmetic with timedeltas, and handle time zones using the datetime module.

03

Python Tutorial: Using Try/Except Blocks for Error Handling

How exceptions work and how to handle them: try, except, else, and finally blocks, catching specific errors, and raising your own exceptions.

04

Python Tutorial: Logging Basics - Logging to Files, Setting Levels, and Formatting

How to replace print statements with the logging module: log levels, writing logs to a file, and formatting your log messages.