[Tutor] updating Unix config file

Alan Gauld alan.gauld at btinternet.com
Mon Oct 19 21:07:47 CEST 2009

"Matt Herzog" <msh at blisses.org> wrote

> remembered that strings are immutable. 
> So how was I able to change the strings for my dotted quad? 

You didn't.

>    lns = cf.readlines()
>    lns = "".join(lns)
>    lns = re.sub(LASTKNOWN, CURRENT, lns)

I assume this is the line in question?
sub() returns a new string containing the substitutions.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list