Python Programming - Reading and Writing Files - Discussion

Discussion Forum : Reading and Writing Files - General Questions (Q.No. 97)
97.
How can you read and print the contents of a binary file named "binary.dat"?
with open("binary.dat", "rb") as file:
    print(file.read())
print_binary_content("binary.dat")
with open("binary.dat", "r") as file:
    print(file.read())
with open("binary.dat", "rb") as file:
    print(file.readlines())
Answer: Option
Explanation:
Using open() in binary read mode to read and print the binary content.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.