Replace multiple lines in a txt file.

Emile van Sebille emile at fenx.com
Mon Aug 23 15:18:00 EDT 2010


On 8/23/2010 12:13 PM Emile van Sebille said...
> On 8/23/2010 11:22 AM Alban Nona said...
>> Hi everybody,
>>
>> I would like to know if its possible to modify a list of entry that is
>> define into a list and replace it by another list ?
>> I try this piece of code, but Im pretty sure I messed something:
>>
>> http://pastebin.com/HfdkGeB3
>>
>>
>
> The code you posted references variables not defined within the snippet,
> so it's hard to guess what may be wrong.
>
> Emile
>


One thing stands out --

fopen = open(_path).read()
for passe in _passeFettel:
     fopen.write(re.sub(passe, _fileFettel)


fopen contains the data read from _path and certainly has no write method.

Emile




More information about the Python-list mailing list