26 solutions available
Question 26The correct syntax of seek() is :file_object.seek(offset[, reference_point])seek(offset[, reference_point])seek(offset,...
Question 9What are the advantages of saving data in :(i) binary form(ii) text form(iii) csv files ?
Question 13How many file objects would you need to create to manage the following situations ? Explain.(i) to process three files sequentially(ii) to...
Question 2If the file 'poemBTH.txt' contains the following poem (by Paramhans Yoganand) :God made the Earth; Man made confining countries And their...
Question 3Consider the file poemBTH.txt given above (in previous question). What output will be produced by following code fragment ?obj1 =...
Question 7Consider the file "contacts.csv" created in above Q. and figure out what the following code is trying to do?name = input("Enter name :")...
Question 8Consider the file poemBTH.txt and predict the output of following code fragment. What exactly is the following code fragment doing ?f =...
Question 14(b)Identify the error in the following code.import csv f = open('attendees1.csv') csv_f = csv.reader() for row in csv_f: print(row)
Question 1Write a program that reads a text file and creates another file that is identical except that every sequence of consecutive blank spaces is...
Question 4Write a program to count the words "to" and "the" present in a text file "Poem.txt".
Question 5Write a function AMCount() in Python, which should read each character of a text file STORY.TXT, should count and display the occurrence of...
Question 6Write a program to count the number of upper-case alphabets present in a text file "Article.txt".
Question 10Write a method/function DISPLAYWORDS() in python to read lines from a text file STORY.TXT, and display those words, which are less than 4...
Question 11Write a program that reads characters from the keyboard one by one. All lower case characters get stored inside the file LOWER, all upper...
Question 12Write a function in Python to count and display the number of lines starting with alphabet 'A' present in a text file "LINES.TXT". e.g.,...
Question 14Write a program that will create an object called filout for writing, associate it with the filename STRS.txt. The code should keep on...
Question 16Consider the following definition of dictionary Staff, write a method in python to search and display content in a pickled file staff.dat,...
Question 17Considering the following definition of dictionary COMPANY, write a method in Python to search and display the content in a pickled file...
Question 18Write a function to search and display details of all trains, whose destination is "Delhi" from a binary file "TRAIN.DAT". Assuming the...
Question 19A binary file "Book.dat" has structure [BookNo, Book_Name, Author, Price].(i) Write a user defined function CreateFile() to input data for...
Question 20Write a function Show_words() in python to read the content of a text file 'NOTES.TXT' and display only such lines of the file which have...
Question 21Write a Python program to read a given CSV file having tab delimiter.
Question 22Write a Python program to write a nested Python list to a csv file in one go. After writing the CSV file read the CSV file and display the...
Question 23Write a function that reads a csv file and creates another csv file with the same content, but with a different delimiter.
Question 24Write a function that reads a csv file and creates another csv file with the same content except the lines beginning with 'check'.
Question 25Give any one point of difference between a binary file and a CSV file.Write a Program in Python that defines and calls the following user...