Question: I am using to python to write integers to a file named number.dat. Next, I want it to read those numbers written to the numbers.dat
I am using to python to write integers to a file named number.dat. Next, I want it to read those numbers written to the numbers.dat file.
I have written the code that works with strings but I want it to accepts integers and read them. Can you help me fix the following code:
myFile = open("numbers.dat",'w')
myFile.write(13) myFile.write(14) myFile.close()
FileHandle = open("numbers.dat",'r')
print(FileHandle.read())
FileHandle.close()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
