How to turn lists into arguments for an object? [closed]

  python, python-3.x

I have an assignment where I have to write player stats onto a file and then use the stats to create an object, "Player 1", from a created class, "Game Character" then print said stats. I have been able to write then read the stats and split them up into different lists, however, when I try to pass the lists as arguments for the object I get an error: "GameCharacter() takes no arguments". Any help is much appreciated, here is the code:

 player = ("The Donut Murdern", "65n", "20n", "Donut Remains, Empty Coffee Cup, 2-ply Napkins")
stats = open("GameCharacterStats.txt", "w")
stats.writelines(player)
stats.close()

stats = open("GameCharacterStats.txt", "r")
lines = stats.readlines()
p1List = []
for element in lines:
    p1List.append(element.strip())
for element in p1List:
    p1name, p1health, p1damage, p1inventory = map(list, zip(p1List))


class GameCharacter(object):
    def __innit__(self, name, health, damage, inventory):
        self.name = name
        self.health = health
        self.damage = damage
        self.inventory = inventory[""]


player1 = GameCharacter(p1name, p1health, p1damage, p1inventory)

print(player1)

Source: Python-3x Questions

LEAVE A COMMENT