so i created a class that holds a baseball players year, name, stats. I am now trying to read from a txt file that holds the players information and create a list of objects. I cannot seem to figure out how to do so.
Here is the class:
class PlayersYear:
    def __init__(self, year, player, stats):
        self.__year = int(year)
        self.__player = player
        self.__stats = stats
Now I am trying to read from a file that list the stats like this lets call it baseball.txt:
1971Hank Aaron:162:22:3:47:495
2002Barry Bonds:149:31:2:46:403
1974Rod Carew:218:30:5:3:599
i am trying to read these in an create an PlayersYear object and append it to a list. I am completely lost and would appreciate some help. Thank you!
This is what I have and I know its wrong
def readPlayerFile(filename):
    baseball = []
    file_in = open(filename, 'r')
    lines = file_in.readlines()
    for i in lines:
        baseball.append(PlayersYear(year, name, stats))
    file_in.close()
    return baseball
 
    