Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Recursive File Read, update
I am very new to python and thanks for your support.
I am trying to write a program to read all the .DAT files in the given folder and its sub folders.
Then in each of the .DAT file, I want to replace a perticular string - this string appears within first 10 lines in the file.
For example: The files have below string on line 4 or 7.
[color=Blue]Name : TESTNAME[/color]
I want to update (append) the name with the filename. The output is like
[color=Blue]Name : FILENAME_TESTNAME[/color]
(FILENAME is the name of the file without .DAT extension)
any help... thanks.