CBSE Class 12 Computer Science Question 97 of 136

Data File Handling — Question 36

Back to all questions
36
Question

Question 36

Write appropriate statements to do the following:

(a) To open a file named "RESULT.DAT" for output.

(b) To go to the end of the file at any time.

Answer

(a) To open a file named "RESULT.DAT" for output:
file = open("RESULT.DAT")

(b) To go to the end of the file at any time:
file.seek(0, 2)