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.
Shathana. S.R. Answered question May 29, 2023
- Open file in write mode using open() function.
- Write string to the file using write() method.
- Close the file using close() method.
BrindhaPrathaban Answered question May 25, 2023
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
