Python Foundation

+91-7982108418            
                         PYTHON FILE HANDLING IMPORTANT QUESTION

 

1. Write a Python program to read an entire text file.

2. Write a Python program to read first n lines of a file.

3. Write a Python program to append text to a file and display the text.

4. Write a Python program to read last n lines of a file.

5. Write a Python program to read a file line by line and store it into a list.

6. Write a Python program to read a file line by line store it into a variable.

7. Write a Python program to read a file line by line store it into an array.

8. Write a python program to find the longest words.

9. Write a Python program to count the number of lines in a text file.

10. Write a Python program to count the frequency of words in a file.

11. Write a Python program to get the file size of a plain file.

12. Write a Python program to write a list to a file.

13. Write a Python program to copy the contents of a file to another file .

14. Write a Python program to combine each line from first file with the corresponding line in second file.

15. Write a Python program to read a random line from a file.

16. Write a Python program to assess if a file is closed or not.

17. Write a Python program to remove newline characters from a file.

18. Write a Python program that takes a text file as input and returns the number of words of a given text file.

19. Write a Python program to extract characters from various text files and puts them into a list.

20. Write a Python program to generate 26 text files named A.txt, B.txt, and so on up to Z.txt.

21. Write a Python program to create a file where all letters of English alphabet are listed by specified number of letters            on each line.

Powered by BetterDocs

Contact Us
close slider