[Tutor] why does this fail

Alan Gauld alan.gauld at btinternet.com
Wed Aug 25 20:32:59 CEST 2010


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

> It's for learning purposed but I forget that de module string 
> has built in functions.Thank you for remainding it to me.

Its not the string module that Christian is referring to, 
its the methods of string objects - different things:


You can do:

import string
string.replace(aString, aChr, another)  # use string module

But its better to do

aString.replace(aChr, another)   # use string method

HTH,


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




More information about the Tutor mailing list