Modules, Packages, and File Operations

Learning Objectives

By the end of this chapter, you will be able to:

  • Describe what Python modules are and create your own
  • Describe what Python packages are and create your own
  • Work with the built-in Python modules
  • Describe the file object in Python
  • Read and write to Python files
  • Work with structured data in Python files

This lesson introduces Python modules and packages. We also cover file operations available to us in Python.

Introduction

In the previous chapter, we have covered object-oriented programming in depth. We have covered important OOP concepts such as classes, methods, and inheritance. In this chapter, we will take a look at modules and file operations.

When you are working on any ...

Get Python Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.