Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.2k views
in Computer by (49.6k points)
closed by

Write the file mode that will be used for opening the following files. Also, write the Python statements to open the following files: 

a) a text file “example.txt” in both read and write mode 

b) a binary file “bfile.dat” in write mode 

c) a text file “try.txt” in append and read mode 

d) a binary file “btry.dat” in read only mode.

1 Answer

+1 vote
by (51.9k points)
selected by
 
Best answer

a = In W+ mode example :- file = open( "example.txt", "w+" )

b = In wb mode example :- file = open("bfile.dat" , "wb" )

c = In a+ mode Example :- file = open ( "try.txt" , "a+" )

d = In rb mode Example :- file = open( "btry.dat" , "rb" )

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...