Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 5

20 bytes added, 16:51, 4 September 2017
PART 1 - Reading Data From Files
help(f.readlines) # help for reading all lines and stores in a list
help(f.readline) # help for reading first line, if run a second time it will read the second line, then third
help(f.writable) # help for writing all lines and stores in determining if a stringfile is writable
help(f.close) # help for closing the opened file
f.writable() # Object method (function returns valueconfirm if file is writable)f.name # Object attribute (variable stringcontains name of opened file)f.closed # Object attribute (variable booleanconfirm if file is closed)
</source>
:#Next, issue the following commands to read data from the buffer of the opened file and store the contents into a variable called "read_data", and then confirm the contents of the variable "read_data:<source lang="python">
13,420
edits