Q1. Write a program in python to read entire content of file ("data.txt")
Q2. Write a program in python to read first 5 characters from the file("data.txt")
Q3. Write a program in python to read first line from the file("data.txt")
Q4. Write a program in python to display number of lines in a file("data.txt").
Q5. Write a program in python to display first line from the file("data.txt") using readlines().
Q6. Write a program in python to display first character of all the lines from the file("data.txt").
Q7. Write a program in python to display all the lines from the file("data.txt") with first character in uppercase.
Q8. Write a program in python to find the number of characters in a file ("data.txt").
NOTE: The above program will also count EOF character so displayed length of file is different from actual length of file
Q9. Write a program in python to find the number of characters in first line of file ("data.txt") using readline()
Q10. Write a program in python to find the number of characters in first line of file ("data.txt") using readlines().
Q11. Write a program in python to display last two characters of all the lines from the file("data.txt").
Q12. Write a program to read all the characters from the file("data.txt") and display in uppercase.
Q13. Write a program to count all the upper case characters from the file ("data.txt").
Q14. Write a program to count number of spaces from the file ("data.txt").
Q15. Write a program to count number of vowels in a file ("data.txt").
Q16. Write a program to write following data in a file "data.txt"
I am learning python
I am in Father Agnel School
NOTE: While writing, we need to add EOF(\n) after every line.
Q17. Write a program to read data from "data.txt" and write in another file "dest.txt"
Q18. Write a program to read all data from "data.txt" and write entire data in another file "dest.txt" except the spaces.
Q19. Write a program to read all data from "data.txt" and write in another file "dest.txt" except the vowels.
Q20. Write a program to read all data from "data.txt" and write alternate line (write first line, skip second line and so on)to another file "dest.txt".
Q21. Write a program to read data from file "data.txt" and count the frequency of word input from user.
Q22. Write a program to read entire data from the file "data.txt" and write only those lines to file "dest.txt" which starts from word "The".
Q23. Write a program to read entire data from file "data.txt" using readline() method.
NOTE: We can read entire data of a file using read(), readline() and readlines()
Q24. Write a program to read the content from file "data.txt" and write to file "dest.txt" after changing the case(convert lower case to upper case and vice-versa)
Q25. Write a program to create a list of 5 numbers (input from user) and write that list in a file "data.txt".
No comments:
Post a Comment