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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!