Computer Science
Write statements to open a binary file 'C:\Myfiles\text1.dat' in read and write mode by specifying the file path in two different formats.
Python Data Handling
1 Like
Answer
The two different formats of specifying file path for opening the file C:\Myfiles\text1.dat in read and write mode are:
file1 = open("C:\\Myfiles\\text1.dat", "rb+")file2 = open(r"C:\Myfiles\text1.dat", "rb+")
Answered By
1 Like
Related Questions
What is the significance of a file-object ?
How are open() functions different from close() functions other than their functionality of opening and closing files?
In which of the following file modes, the existing data of file will not be lost ?
- 'rb'
- ab
- w
- w + b
- 'a + b'
- wb
- wb+
- w+
- r+
What would be the data type of variable data in following statements ?
- data = f.read()
- data = f.read(10)
- data = f.readline()
- data = f.readlines()