Python Input and Output
Python Input and Output - Important Points
31. | Which of the following is used to read a binary file in Python? |
---|
A. 'rb'
B. 'wb'
C. 'ab'
D. 'xb'
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The 'rb' mode is used to read a binary file in Python.
32. | Which of the following is used to write binary data to a file in Python? |
---|
A. 'rb'
B. 'wb'
C. 'ab'
D. 'xb'
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The 'wb' mode is used to write binary data to a file in Python.
33. | Which of the following is used to append binary data to a file in Python? |
---|
A. 'rb'
B. 'wb'
C. 'ab'
D. 'xb'
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The 'ab' mode is used to append binary data to a file in Python.
34. | Which function is used to read an Excel file in Python? |
---|
A. openpyxl.load_workbook()
B. openpyxl.read_excel()
C. openpyxl.write_excel()
D. D. openpyxl.dump_excel()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The openpyxl.load_workbook() function is used to read an Excel file in Python.
35. | Which function is used to write to an Excel file in Python? |
---|
A. openpyxl.load_workbook()
B. openpyxl.read_excel()
C. openpyxl.write_excel()
D. D. openpyxl.dump_excel()
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The openpyxl.write_excel() function is used to write to an Excel file in Python.