How to loop until all lines read from a file : I'm trying to set up a score system where I need to input all the scores from a text file into an 'array of records'.

I'm fairly new to Python and hope for a simple solution.

In my program, the array of records would technically class as a list of namedtuples.

Currently I have:

Player = namedtuple("Player", ["name", "result", "difficulty", "score"])
Playerlist = []

    while str(f.readline) != '':
        player = Player(
            f.readline(),
            f.readline(),
            f.readline(),
            f.readline())
        Playerlist.append(player)



I tried to print(Playerlist[0]), but nothing shows up.

I have also tried to print(Playerlist[0]) without any loop and got the expected result, though I won't have stored all the data from the text file into my program.