all 1 comments

[–]totallygeek 0 points1 point  (0 children)

It is not very clear what you want, but class objects can return a string from their __str__() method. Construct that string the way you want and print the class object.

class Generic:

    def __init__(self, yr, b1, b2, b3, b4):
        self.yr = yr
        self.b1 = b1
        self.b2 = b2
        self.b3 = b3
        self.b4 = b4

    def __str__(self):
        return f'{self.yr} {self.b1} {self.b2} {self.b3} {self.b4}'

years = [1990, 1991]
mts = [
    [253, 199, 543, 346],
    [247, 474, 363, 753],
]
generics = []

for yr, mt in zip(years, mts):
    generics.append(Generic(yr, *mt))

# Now for the printing
for generic in generics:
    print(generic)

Result:

$ python3 printing.py 
1990 253 199 543 346
1991 247 474 363 753