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.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!