Name: [002] Ian Ozsvald
Member: 128 months
Authored: 181 videos
Description: I am the co-founder of ShowMeDo (see, author of `The Screencasting Handbook <>`_ and the founder of the professional screencast production company `ProCasts <>`_: .. image:: ...

Python Beginners - File I/O [ID:716]

a series of video-tutorials by Ian Ozsvald

Learning basic file input/output opens up the world of reading data in, manipulating it and exporting or storing it for future use.

In this series we cover reading and writing text files, examples of binary files and using the built-in cPickle (serialisation) module.

Video Tutorials

1. 2 Minute Introduction (File I/O)

This 2 minute introduction covers the following four episodes where we cover reading text files into Python, reading and writing text files, reading and writing binary files and persisting data with cPickle.

2. Reading Text Files with Python

Here we use open to open a text file and read its contents in in one go. Next we iterate over the lines printing them to the screen.

3. Reading and Writing Text Files

Next we build upon the previous episode, this time we use raw_input to ask the user a question after every line is shown. Having gathered the answers we write out a new text file which combines both the originally read data and the user's input.

4. Reading and Writing Binary Files

Binary files are a large topic. Rather than dwell on Windows-specifics (because Binary files are most relevant to Windows machines) instead I link to a number of examples and then give an example of manipulating a binary image file using the Python Image Library. First, read up on File objects and see lots of uses in this long file i/o tutorial. Next, if you need the csv library read on the use [...]

5. Serialising for persistence with cPickle

cPickle lets us serialise our data very simply to a file. This means we can build up a datastore that is persistent between runs of our Python code and we don't need to write any parsers to load it back in - we just un-pickle it. To understand the limitations, see what can and can't be pickled.

Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Kudos and Thanks for Ian

3 Minute Oveview (What Does Python Look Like?)

simple and informative. you draw me in
70 months ago


Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.