How to replace multiple-line text

Fernando Pérez fperez528 at yahoo.com
Thu Jul 11 22:28:15 EDT 2002


David Lees wrote:

> 
>>>> import string
>>>> x='this is junk'
>>>> string.replace(x,'junk','stuff')
> 'this is stuff'
> 
> Time to do some more reading on classes, since I don't understand why it
> is not necessary to import string here.
> 
> 
what you posted is ok, simply an alias to the string methods. After 2.x (or 
earlier?) python has subsumed most of the string module's functionality into 
methods which are part of all strings you create.

cheers,

f.



More information about the Python-list mailing list