[Tutor] why does this fail

Alan Gauld alan.gauld at btinternet.com
Thu Aug 26 10:22:20 CEST 2010


"Roelof Wobben" <rwobben at hotmail.com> wrote

> then I have a problem.
>
> Im following this book : 
> http://openbookproject.net/thinkcs/python/english2e/
> which is the first link  in the beginners tutorial page.
>
> And it's talking about the string modules.

So it is which is quite bizarre since it is using Python 2.5!

The string module is deprecated and in Python v3 has had most of the
functions removed. Do not use ther string module functions, use the 
string
methods instead. It is usually a simple translation from

string.function(aString, other args...)

to

aString.method(otherargs...)

You can check the documentation for the string methods using

>>> help(str)

I don't want to put you off the tutorial because it is quite a good 
tutor,
but I never noticed it was still promoting the use of the string 
module
before - very odd!

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list