Chapter 23. Using Python libraries

 

This chapter covers

  • Managing various data types—strings, numbers, and more
  • Manipulating files and storage
  • Accessing operating system services
  • Using internet protocols and formats
  • Developing and debugging tools
  • Accessing PyPI, a.k.a. “the Cheese Shop”
  • Installing Python libraries using setup.py

Python has long proclaimed that one of its key advantages is its “batteries included” philosophy. This means that a stock install of Python comes with a rich standard library that lets you handle a wide variety of situations without the need to install additional libraries. This chapter will give you a high-level survey of some of the contents of the standard library as well as some suggestions on finding and installing external modules.

23.1. “Batteries included”—the standard library

In Python, what’s considered the library consists of several different components. It contains built-in data types and constants that can be used without an import statement, like numbers and lists, as well as some built-in functions and exceptions. The largest part of the library is an extensive collection of modules. If you have Python, you also have libraries to manipulate diverse types of data and files, to interact with your operating system, to write servers and clients for many internet protocols, and to help develop and debug your code.

23.2. Moving beyond the standard library

23.3. Adding more Python libraries

23.4. Installing Python libraries using setup.py

23.5. PyPI, a.k.a. “the Cheese Shop”

23.6. Summary