Example HTML page

P-Assignment 15: Files

Hi,

Please do the following programs.

  1. Write a python script to read a text file using file open method. The file content is minimum of 50 characters.
  2. Write a python script to read a text file from the user and print the contents of it.
  3. Write a python script to read a text file using functions.
  4. Write a python script to read first 10 characters of a file.
  5. Write a python script to read the characters from 20 to 30.
  6. Write a python script to print ‘5’ characters from index position 40. In the same program, set the pointer to beginning and print 10 characters.
  7. Write a python script to read first ‘5’ lines in the file. The file should contain minimum 7 lines.
  8. Write a python script to add a string at the end of the file. String is: “This is new line appended”.
  9. Write a python script to read last ‘5’ lines in the file.
  10. Write a python script to read line by line from the file and store each line in a list.
  11. Write a python script to read the content from the file and count the number of words in it.
  12. Write a python script to read the content from the file and count the number of vowels and consonants in it.
  13. Write a python script to copy the contents of a file to another file.
  14. Write a  python script to read a random line from the file.
  15. Write a python script to read a file and remove the ‘\n’ from the from the lines.
  16. Write a python script to count the number of lines in a file.
  17. Write a python script to read a character from the user and check the number of occurrences of this character in a given file. for example if the input is ‘a’, check how many number of time ‘a’ is in the file.
  18. Write a python script to count the number of spaces in a given file.
  19. Write a python script to read a file and capitalize the first letter in each word.
  20. Write a python script to read the contents in reverse order.
Example HTML page

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest