About files

3 important questions on About files

How can you open and read a file?

1.    the_file =  open("file.txt")
2.   contents = the_file.read()

What does the function .readlines() do?

This retrieves the contents of the file in a list.

What function can be used with the .read() to store the elements in a list?

.split()

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo