230k views
0 votes
if you wanted to read a single line of a file for which you had the file variable scores file and store it in the variable line what python statement would you write?

User BBedit
by
9.4k points

1 Answer

1 vote

You can use the readline() method to read a single line of a file and store it in a variable. Here's an example:

line = scores_file.readline()

This will read the next line of the scores_file and store it in the variable line. If there are no more lines in the file, line will be an empty string.

User CJ Zougloub
by
8.2k points

No related questions found