Python/Files

< Python

Objective

  • Learn a little bit about files.
  • Learn about the built-in function open().
  • Learn how to read, write to, and seek in a file.
  • Learn about abstractions that act like files.
  • Learn about the optional parameters for open().
  • Learn how to rename, remove, move, and create files.

Lesson

What's A File

When working with on a computer, files are usually used in daily tasks. You may spend your days writing word documents for a news company or you may like to listening to your mp3 files on your free time. You most likely already have an abstract idea of what a file is; a piece of information that's stored on a disk. So what exactly is a file?

Opening A File

A file is just a group of 1's and 0's that are stored on the disk. Since the operating system takes care of managing them, you don't have to worry about their technical details. To use files in Python, you'll needed to use the built-in function open().

Assignments

Completion status: this resource is a stub, which means that pretty much nothing has been done yet.

This article is issued from Wikiversity - version of the Friday, June 05, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.