Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.
Well done!
You have completed (UPI) Chapter 16: Working with Files in Python!
Instruction
Using read() and Reading Lines
Python provides functions that can be called on a file object for reading the contents of a file:
-
The
read()
function reads the contents of a file and returns a string.
-
The
readline()
function reads the next line in a file and returns a string.
- **The
readlines()
function reads the individual lines of a file and returns a string list containing all the lines of the fil...