PYTHON Using the file object input write code that read an i

PYTHON: Using the file object input, write code that read an integer from a file called rawdata into a variable datum (make sure you assign an integer value to datum). Open the file at the beginning of your code, and close it at the end.

Solution

ReadInt.py

input = open(\"rawdata.txt\", \"r\")
datum = input.read()
print datum
input.close()

Output:

5

PYTHON: Using the file object input, write code that read an integer from a file called rawdata into a variable datum (make sure you assign an integer value to

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site