- Differentiate between file modes rb+ and w+ with respect to Python.
- Write a method in Python to read lines from a text file DIARY.TXT, and display those lines, which are starting with an alphabet ‘P’.
- When do you think text files should be preferred over binary files?
- Write the difference between relative and absolute path?
- Write the short note on the following?
- docstrings
- why a package is attached to site-package folder of python installation?
- Write a method in python to write multiple line of text contents into a text file mylife.txt line.
- What is the output of the following code:
File (myOutFile.txt) contents: You may write me down in history With your bitter, twisted lies, You may trod me in the very dirt But still, like dust, I'll rise. fh=open("myOutFile.txt","r") size=len(fh.read()) print(fh.read(5))
- Write a program to count and display the number of uppercase letters present in text file’s (“Article.txt”) first and last line.
- What is the use of flush() Function? Explain using suitable examples?
- Write a function stats() that accepts a filename and reports the file's longest line.
- Write a statement in Python to perform the following operations :
- To open a text file “Book.txt” in read mode
- To open a binary file “Book.dat” in write mode
- Write a program to count the words “to” and “the” present in a text file “Poem.txt”.
No comments:
Post a Comment