Check sibling questions
Computer Science - Class 12
Chapter 2 - File Handling in Python

To open a file c:\scores.txt for reading, we use

 

Answer:

The syntax to open a file in python is as follows:

file_object= open(file_name, access_mode) 

Here, 

  • the file_name will be c:\\scores.txt
  • The file should be opened for reading ,  so access_mode is “r” .

Therefore, the correct answer will be

infile = open(“c:\\scores.txt”, “r”)

 

So, the correct answer is (b). 

Introducing your new favourite teacher - Teachoo Black, at only ₹83 per month

CA Maninder Singh's photo - Expert in Practical Accounts, Taxation and Efiling

Made by

CA Maninder Singh

CA Maninder Singh is a Chartered Accountant for the past 12 years. He also provides Accounts Tax GST Training in Delhi, Kerala and online.