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

Build a simple file-reader using PyDev [ID:141] (7/10)

in series: Python Development on XP

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

Writing your first Python program may feel daunting - follow me here as I show you how to start a simple program inside PyDev (you could write this in any editor). I cover the useful features of PyDev including tooltips, auto-completion and using a 'Extract Method' refactoring tool (great for cleaning up your code!).

This simple script will read a list of numbers from a text file (as strings) and convert these to integers. We create a simple text file of numbers and process them using a Python loop, storing the converted integers in an array. This demonstrates simple looping and data processing techniques which will be useful if you need to process your own data.

The source code and data file (, nbrs.txt) are available in the wiki so you can cut/paste them onto your own system.

To talk to your fellow Pythonistas you should join the ShowMeDo Learners Google Group.

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 347 (since July 30th)
  • Plays in last week: 0
  • Published: Sometime before 1st March 2007 (in other words - we don't remember!)

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

nice explanation

Some of the menus in the newest releases of Eclipse/PyDev are not the same as in this tutorial.

Ian, I've found your videos very helpful and thoughtful. Your efforts have saved me countless hours, so thanks. I'm new to Python, but very much enjoy it (background in c++ and object pascal, but some years ago. I'm now an optometrist and wish to create an interactive graphing app. Perhaps you'll take a question or two? Thanks again for the videos.Keep up the good work!

Nice video, I really like the Eclipse environment.

It's very nice and full featured; makes your job a bit easier. I especially like the fact that you can get support for many languages and dynamic languages inside the same environment, so you don't have to switch back and forth between different environments. Enjoyed the demo :- )

Review of Build a simple file-reader using PyDev

My Eclipse version 3.3.2 didn't behave the way your version did.

You should mention what versions of software you're using. You should also have some text boxes that mention the key points.

thanks ian this one was good episode.. i m new user and hopefully i can pick it up with ur series

Ok, this was pretty helpful. Eclipse I got set up during previous episode--that was kind of a pain as I am of course a newbie and there were subtle changes in eclipse's appearance & behavior. Once one understands how to do simple things--like getting the da**#@ navigator window to open or rearranging windows--then those things become "intuitive"...But I tried to do those things, read the online docs, looked at Fabio's help and no joy. Then for some reason, whether due to something I did or just cosmic rays, navigator opened & I could rearrange, etc... I could not get pydev to immediately execute the "run" without having to specify 'python run' from the menu--each of the entire dozen or so times I did it while in the lesson. Then just now (5 or 10 min later) I clicked run and then pressed F11 and the thing instantly executed both times!! Is it deliberately playing with me? ;-)

Eclipse has been updated which is partly responsible for some difficulty in determining that I'm correctly following the lesson. But there are also benefits: now refactoring is smarter, it knows to move the def of readNumbers before it it is called, thus avoiding the error Ian had!

Thanks Ian that was a great episode clearly explained and demonstrated yet still capturing the concepts required to expand programming knowledge.

I still get a little confused between methods, functions and classes and what needs to be defined etc, but it is still early days for me and these screencasts are proving invaluable.

Top job. Keep up the excellent work.


Buying PyDev - to be honest I still use the standard PyDev (free) plugin. I haven't tried the Extensions yet...I keep meaning to but just haven't felt that the standard PyDev holds me back.

You might have seen that Fabio (author of PyDev) has a pair of videos, the second is about the Extensions:

so that might tell you if you need to buy it? You can certainly try it for free for a while. Perhaps you could share your experiences here if you liked it, to let others know that they should try it?


Fantastic as always - I could hardly keep up with the code! Don't slow down on my account - I would rather have it all packed in - the more advanced the better. By the way, should I purchase PyDev?

According to 'Python in a Nutshell' a function is 'a group of statements that executes upon request' (pg. 58). Generally a 'def' is a 'function', that's the normal term.

In the context of a Class a 'def' refers to a 'method' - it is *still* a function but it is bound to a Class attribute so the labelling changes.

Therefore your example was correct when you state "function(object)" versus "object.method", but fundamentally they both refer to functions under-the-hood.

Practically if you refer to functions or methods - everyone will understand you, but yes it is worth getting these definitions correct to avoid confusion.


Hmm, terminology, I'll have to look into the exact definitions of function and method and I'll post again about this later.

Re. "nbrs = []", yes I should have said 'list' rather than 'array' - that's years of experience across many languages, I guess that was a bit of Java drifting in to my speech. You are right to question, it is important to get these terms right.


Questions and FurtherComments

In reference to "line.strip()", I believe you said that strip was a function that operates on the string called "line". Did you mean method? Is there a meaningful distinction other than the notation ("function(object)" versus "object.method")? I've noticed that some functions seem to have been deprecated in favor of methods. Is there a move to view everything as a method, and therefore to use the words "function" and "method" interchangeably?

In reference to "nbrs = []", I believe you said that the statement created an array. Did you mean a list? Maybe it's a list that functions as a one dimensional array? I hate to be picky, but I tend to think by means of words (rather than thinking directly about things, as did, for example, G.K. Chesterton), so I have to get definitions exactly right or I get confused.

When you use the refactoring tool, Pydev can now automatically move the definition of the new function to the top of the module. Maybe they heard you. :-)

I like the idea of learning to write more reliable code, and can't wait to get on to the next lesson, so I think I'll put everything else on hold and forge right ahead.

These lessons are so good it's hard to stop.

This is a very good "close to real worl programming" session in eclise+pydev.

Very sensible approach to include refactoring and unitesting in this early stage, rather than diving into the boring details of python syntax...

I like it.

But my eclipse(3.2.2)+python gave an error when I try refactoring... It is fixed the error. Also, it automatically puts the def at the beginning by default, which avoids the error you showed in the episode...


Hi Osman. Yes, these 6 videos do not play as they are in a 'preview state'. I will mail you privately to see if you'd like to join the preview group...


There is a problem with this page.

Not playing

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



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.