KnowledgeBoat Logo
|

Class - 12 CBSE Computer Science Important File Handling Questions 2025

Write statements to open a binary file C:\Myfiles\Text1.txt in read and write mode by specifying file path in two different formats.

Python File Handling

10 Likes

Answer

The two different formats of specifying file path for opening the file C:\Myfiles\Text1.txt in read and write mode are:

  1. file1 = open("C:\\Myfiles\\Text1.txt", "rb+")

  2. file2 = open(r"C:\Myfiles\Text1.txt", "rb+")

Answered By

7 Likes