Script to replace contents inside the files

Peter Otten __peter__ at web.de
Mon Jul 24 12:37:18 EDT 2017


Kunal Jamdade wrote:

> I have thousands of html files inside a folder. I want to replace the
> filename present inside another files. Say for ex:- fileName :-
> 'abcd1234.html' is found inside another file say file2.html. Then I want
> to remove the last 4 digits of the fileName i.e,. 'abcd1234.html' =>
> 'abcd.htm'.
> 
> I have tried a script .

Does your script work? If not post the parts that do not and ask specific 
questions.

> But your suggestions upon the script are welcomed.

Your problem exposition looks simpler than your implementation, but it's 
impossible for anyone but you to tell apart necessary complications from 
implementation artifacts.

Heed the advice given on http://sscce.org/ and you will likely get better 
answers.





More information about the Python-list mailing list