Python Input and Output
Python Input and Output - Important Points
26. | Which function is used to read a JSON file in Python? |
---|
A. json.read()
B. json.load()
C. json.write()
D. D. json.dump()
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The json.load() function is used to read a JSON file in Python.
27. | Which function is used to write to a JSON file in Python? |
---|
A. json.write()
B. json.load()
C. json.dump()
D. D. json.read()
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The json.dump() function is used to write to a JSON file in Python.
28. | Which of the following is used to read binary data from a file in Python? |
---|
A. read()
B. readline()
C. readlines()
D. D. None of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The read() method is used to read binary data from a file in Python.
29. | Which of the following is used to write binary data to a file in Python? |
---|
A. write()
B. writelines()
C. append()
D. D. None of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The write() method is used to write binary data to a file in Python.
30. | Which of the following is used to append binary data to a file in Python? |
---|
A. write()
B. writelines()
C. append()
D. D. None of the above
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The append() method is used to append binary data to a file in Python.