Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 5

37 bytes added, 16:25, 4 September 2017
PART 1 - Reading Data From Files
f.closed # Object attribute (variable boolean)
</source>
:#Next, issue the following commands to read data from the buffer of the opened file and store that data the contents into the a variable called "read_data", and then confirm the contents of the variable "read_data:<source lang="python">
read_data = f.read()
read_data
</source>:#<br>Prior to closing the file, you should close the file in order to free up the computer resources. First lets check to see if the file is already closed. <br><br>:#Issue the following object attribute will provide a boolean value if the file is closed (true) or open (false):<source lang="python">
f.closed
</source>
13,420
edits