newbie problem with str.replace
Anthony Tolle
anthony.tolle at gmail.com
Wed Aug 4 09:22:51 EDT 2010
On Aug 4, 9:10 am, BobAalsma <bob.aal... at aalsmacons.nl> wrote:
> #
> bestandsnaam_nieuw = bestandsnaam
> bestandsnaam_nieuw.replace(KLANTNAAM_OUT,KLANTNAAM_IN)
The replace method does not modify the string (strings are immutable).
You need to use the retun value of the method in an assignment, like
so:
bestandsnaam_nieuw = bestandsnaam.replace(KLANTNAAM_OUT,KLANTNAAM_IN)
This will not change the value of bestandsnaam
More information about the Python-list
mailing list