@extends('template') @section('title') Lab 11 @stop @section('content') # Lab 11: File Operations {{-- ## [Solutions](/content/labs/solutions/lab11/) --}} ## Summary Practice reading from files and writing to files @include('/labs/_setup', ['folder' => 'lab11']) @include('/labs/lab11/_toc') ## Big Questions {.bigqs} - **What's the most important difference between writing output to the Canopy output window and writing output into a file?**
Show Answer Anyone who is familiar with Python programming will be able to see the output of a Python program. But even someone who knows nothing about Python might run a program and then look at a text file that it produced. So writing a file is a more general form of output that doesn't require familiarity with Canopy. Another important difference is that writing to a file can affect other parts of the computer: it's possible to destroy an important file by overwriting it.
- **What's actually in a file when it's stored on your computer?**
Show Answer At a technical level, just bits: ones and zeroes. But in terms of how Python relates to files, those bits are assumed to represent characters in a string, so we can think of files as containing strings. Even an image file or a sound file can be thought of as just a very complex string.
@stop