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 <mrmak...@cox.net> wrote: > On Aug 4, 9:10 am, BobAalsma <bob.aal...@aalsmacons.nl> 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 its replacement in-place. It returns a copy of the > original string, with the replacement done in the copy. You are not > assigning the string returned by string.replace to anything, > therefore, it is immediately thrown away. > > Secondly, and this is just a guess, but since you are doing the > string.replace inside of an os.walk loop, you appear to be trying to > do a filename change. I hope you realize that this will in no way > change the name of the file *on disk*; it will only change it in > memory. > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list