Having trouble with file modes
Hendrik van Rooyen
mail at microcorp.co.za
Sat Nov 4 00:57:21 EST 2006
"erikcw" <erikwickstrom at gmail.com> wrote:
8<--------------------------------
> #loop through patterns list and find/replace data
> for o, r in patterns:
> data = data.replace(o, r)
> print "Replaced %s with %s" % (o, r)
> f.write(data)
> f.close()
>
> This results in an empty file. All of the modes I've tried either
> produce an empty file or append the data onto the end of the file. How
I would take a hard look at what the find and replace does - it acts as if you
are replacing
*everything* with *nothing*....
- Hendrik
More information about the Python-list
mailing list