Follow these Steps to find the number of String Present in the Text File
- Open the file in read mode. Open a file by setting a file path and access mode to the open() function. …
- Read content from a file. Once opened, read all content of a file using the read() method. …
- Search for a string in a file. …
- Print line and line number.
Vishalini.R Answered question May 25, 2023
