Join Club ShowMeDo to Learn Python!

This series is a part of Club ShowMeDo. Click to learn why you should join our club with a simple monthly subscription.

  • We teach Python and all the cool modules
  • Topics include beginner Python, GUIs, Web and Desktop Apps
  • Long, specially crafted video tutorials just for you
  • Club video tutorials extend our normal Free content
  • Save your time - we've done the research for you
  • Keep your skills up-to-date
  • Learn at your own pace, everything you need is shown to you
  • Over 12 hours of archived material are waiting for you in the club

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:: ...

Batteries-included - the csv module [ID:244] (3/17)

in series: Python 101 - easygui and csv

(Showmedo is undergoing major changes. To report any problems viewing the videos please email us and include browser and OS specifics. Cheers - Kyran.)

Python comes with its own comma-separated values (documentation) module - this is useful as there are many wrinkles with csv files that would make writing our own a pain (wikipedia: newline).

Here you learn how to read in the contents of a csv file, one line at a time, as a list of strings.

Task: Copy the csv example code and make the edits shown in the video

Created May 2007, running time 6 minutes.

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 6 (since July 30th)
  • Plays in last week: 0
  • Published: 111 months ago

Thank-yous, questions and comments

If this video tutorial was helpful please take some time to say thank-you to the authors for their hard work. Feel free to ask questions. Let the author know why their video tutorial was useful - what are you learning about? Did the video tutorial save you time? Would you like to see more?

You may also want to see our ShowMeDo Google Group to speak to our active users and authors.

Your email address will not be published.

Show some quick comments >>

All comments excluding tick-boxed quick-comments

a very good start ...

very good one, indeed.

Very good and thorough. Looking forward to completing the series!

Thanks for this. I like the pace at which this is explained and how every step is shown...much better then just a book tutorial.

Batteries-included - the csv module (3/17)

1:20 Read binary for CSV for cross platform

1:52 Wikipedia newline

3:00 import csv

3:20 csv.reader(open

3:40 for row in reader

4:19 output explained [lists of strings]

5:09 Run in DOS


I am following along, but trying ti substitute vi tools in place of WingIDE. What I found I like is:

gvim + pdb + vimpdb plugin for debugger.

Also, this script in your .vimrc will let you run the currently open file though the python interpreter and diaply the output in the preview window.

Great tut

Hi Ian,

Ihave done a lot of importing and exporting csv files in and out of Excel, usually using AWK and regular expressions. The Python csv module makes life so much easier, especially compared to cutting and pasting in Excel. A great tool to have in your toolkit.

Excellent screencast!


Will running the free version of Wing IDE get me through the series? Thanks!

Just as a Kevin reported, I'm reading from a csv file and I'm getting the "line contains NULL byte".


Runtime Error!

line contains NULL byte

Rolling back...



Not sure whatelse to include here, but was trying to get an idea on this "line contains NULL byte" error and if anybody else has had the same issue.

Any help is much appreciated!

All good Ian. I'm with you so far. Onward to the next tutorial.

Hi, I am getting the code to run in the wing IDE environment. However when I try to run the program in DOS I get this error "python: can't open file '' : [Errno 2] No such file or directory."

I created the .csv file in the text editor, saved it in the directory where my .py program lives and cannot run it. Can you offer some help.



I liked the video and it was great to make something that seems like a real program so early on. However the set up of Easygui could have been explained better as I ended spending up a lot more time figuring that out than learning the language itself. As such, the code in the video does not run in my environment.

Very, very helpful.


Brand new to python and could not get command line to run until I had run "set path=%path%;C:\python25" at the command line. Took a while to track down so I thought I would mention it here.

Hi Kevin - I'm mailing you privately to help you out.


i am new to python and found this great video class while I was googling.

I ran into problems with The CSV class - video 2,

I follow the Video trying to run the, the following result shown when I use DOS command lineas well as with IDLE (I do not have Wing IDE), please help in so I go move on :

>>> ================================ RESTART ================================


Traceback (most recent call last):

File "C:\Python25\python-training\OnLineTraining\Class1\", line 3, in <module>

for row in reader:

Error: line contains NULL byte

I was ahead of myself again, by actually listening to the video, I figured it out :)

I must be blind again is there code and a ,csv to download here on this page (I found the examples in the csv doco)

Great tuto, I was just not getting the right output initialy reason being my regional setting were at "french canadian" so I had the comma-period problem, I did switch to "english canadian" and the problem was resolved.

Hi Ryan. The type of an object tells you 'what it is' behind the scenes. Your 'reader' is a part of the 'csv' module.

The reason it says _csv rather than csv is rather technical - the _csv file is a pre-compiled Python module which is used by the public-facing csv module.

On my machine I see in /usr/lib/python2.5 and lives in /usr/lib/python2.5/lib-dynload.

I guess a shorter answer is that the 'type' is the way that Python describes this kind of object, a bit like saying 'book.technical_reference' or 'food.pasta'.

There's an introduction to basic Python types (but not csv) here:

which might give you some more background?


You are an excellent instructor Ian. I have a quick question, when I type the following code in the shell I get this:

>>> type(reader)

<type '_csv.reader'>

What is this specifc type supposed to mean?

Hi ttjfb - the csv module is *built in* to Python, there is nothing extra to install. I will mail you privately so we can check your configuration and sort this out...


Is there a step by step anywhere of installing the CSV module, even though the WINGIDE is 2.3 etc.. it tells me it can't find CSV module?

Fair enough. I gave the example needed for this series but yes, more examples always help, maybe that's something to bear in mind for future series.



I liked the introduction to the CSV module, but I think it might have been a bit better with a few more examples of what the CSV module can do.

very cool video, i learned new things.

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.