[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.

> LASTKNOWN = '173.48.204.168'
>    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.

HTH,


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



More information about the Tutor mailing list