Robots Atlas>ROBOTS ATLAS

Python — From Basics to Advanced · Objects, Errors, Files

Working with Files

Objects, Errors, Files

Introduction

Files are the simplest way to persist data outside program memory. Python uses the open() function and the with statement, which takes care of closing the file automatically. In this lesson you learn the open modes (r, w, a), the difference between text and binary data, and why with is usually better than manual open()/close().