As we have learned all about the basic to advanced operations of File Handling. Hence now we will solve some questions related to our File Handling concepts.
Programming questions on Text Files
- WAP to define a method to read text document line by line.
- WAP to define a method in python to read lines from a text file starting with an alphabet F.
- WAP to define a method to count number of lines starting with an alphabet F.
- WAP to define a method which display only those lines starting with an alphabet A or F.
- WAP to define a method to display only those lines which are bigger than 50 characters.
- WAP to define a method to count total number of characters in our text file.
- WAP to define a method to count total numbers of word available in our text file.
- WAP to define a method which counts the occurrence of particular word in a text file.
- WAP to define a method which only print the words having more than 5 characters.
- WAP to define a method which counts the occurrence of “is”, “to” in a text file.