Q. What will this code do?
file = open('data.txt', 'r')
data = file.read()
file.close()
Code:
file = open('data.txt', 'r')
data = file.read()
file.close()
file = open('data.txt', 'r')
data = file.read()
file.close()
β
Correct Answer: (B)
Reads full content of file into data variable
Explanation: read() reads the whole file content into the data variable.