[Tutor] updating Unix config file
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?
> LASTKNOWN = '184.108.40.206'
> 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.
Author of the Learn to Program web site
More information about the Tutor