Re: newbie problem with str.replace

2010-08-04 Thread Daniel da Silva
Also, for bestandsnaam in dirs and files: is probably not doing what you want. Use + to concatenate lists. Daniel On Wed, Aug 4, 2010 at 6:30 AM, Mike Kent wrote: > On Aug 4, 9:10 am, BobAalsma wrote: > > I'm working on a set of scripts and I can't get a replace to work in >

Re: newbie problem with str.replace

2010-08-04 Thread Mike Kent
On Aug 4, 9:10 am, BobAalsma wrote: > I'm working on a set of scripts and I can't get a replace to work in > the script - please help. >                         bestandsnaam_nieuw.replace(KLANTNAAM_OUT,KLANTNAAM_IN) I'm not sure what you are intending to do here, but string.replace does not do i

Re: newbie problem with str.replace

2010-08-04 Thread BobAalsma
On Aug 4, 3:22 pm, Anthony Tolle wrote: > On Aug 4, 9:10 am, BobAalsma wrote: > > >                         # > >                         bestandsnaam_nieuw = bestandsnaam > >                         > > bestandsnaam_nieuw.replace(KLANTNAAM_OUT,KLANTNAAM_IN) > > The replace method does not modif

Re: newbie problem with str.replace

2010-08-04 Thread Peter Otten
BobAalsma wrote: Although [it] may not be obvious at first unless you're Dutch... > bestandsnaam_nieuw = bestandsnaam > bestandsnaam_nieuw.replace(KLANTNAAM_OUT,KLANTNAAM_IN) str.replace() does not modify a string, it creates a new one. This doesn't work: >>> s = "that's all folks" >>> s.repl

Re: newbie problem with str.replace

2010-08-04 Thread Anthony Tolle
On Aug 4, 9:10 am, BobAalsma 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

newbie problem with str.replace

2010-08-04 Thread BobAalsma
I'm working on a set of scripts and I can't get a replace to work in the script - please help. The scripts show no errors, work properly apart from the replace, all variables are filled as expected, the scripts works properly when the commands are copied to the Python shell. Text Main: .. from Le