Python Intro for Libraries

Adapted for LIBR 559S

This lesson has been adapted (and truncated) from Library Carpentry’s Introduction to Python for Libararies course to focus specifically on the skills needed to create a basic API query using UBC Library’s Open Collections API.

This lesson is not an official Library Carpentry course. The original source can be found at:

This lesson is an introduction to programming in Python for librarians with little or no previous programming experience. It will focus on the skills needed to create basic a basic metadata API query.

This lesson references the Spyder IDE, but can be taught using a regular Python interpreter as well. Please note that this lesson uses Python 3 rather than Python 2.


  1. Learners need to understand what files and directories are, what a working directory is, and how to start a Python interpreter from a terminal window.

  2. Learners must install Anaconda before the class starts.

    Please see the setup instructions for details.


Setup Download files required for the lesson
09:45 1. Getting Started How do I use the Spyder IDE?
How can I run Python programs?
09:55 2. Variables and Assignment How can I store data in programs?
10:10 3. Data Types and Type Conversion What kinds of data do programs store?
How can I convert one type to another?
10:20 4. Built-in Functions and Help How can I use built-in functions?
How can I find out what they do?
What kind of errors can occur in programs?
10:35 5. Lists How can I store multiple values?
10:55 6. Dictionaries How can I represent more complex datasets?
11:10 7. Libraries How can I extend the capabilities of Python?
How can I use software that other people have written?
How can I find out what that software does?
11:20 8. Requests What is a HTTP request?
How can I use requests to get data?
What does a request return?
11:55 9. END? Why here? Why now?
11:55 10. For Loops How can I make a program do many things?
12:20 11. Writing Functions How can I create my own functions?
12:45 12. Variable Scope How do function calls actually work?
How can I determine where errors occurred?
13:05 13. Conditionals How can programs do different things for different data?
13:30 14. Programming Style How can I make my programs more readable?
How do most programmers format their code?
How can programs check their own operation?
14:00 15. Wrap-Up What have we learned?
What else is out there and where do I find it?
14:20 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.